Be careful when using this predefined extractor, which can cause problems. Use this extractor as follows:
char x[50]; cin >> x;
This extractor skips leading whitespace, extracts characters, and copies them to x until it reaches another whitespace character. It then completes the string with a terminating null (0) character.Use this extractor carefully because input can overflow the given array.
You must also be sure the pointer points to allocated storage. The following example shows a common error:
char * p; // not initialized cin >> p;
Because the location where the input data will be stored is unclear, your program might abort.