Home Segments Index Top Previous Next

709: Mainline

Often, it is helpful to add spaces in scanf calls to make them easier to read. That whitespace matches whitespace in the input, if any. Otherwise, the whitespace is ignored:

char input_buffer[100]; 
scanf ("%*s     %*s     %s", input_buffer); 
printf ("The author's surname is %s.\n", input_buffer); 
--- Data ---
   Patrick Henry Winston 
--- Result --- 
The author's surname is Winston.