ALL
Read white space with scanf()
Usually, when we want to enter string with white spaces in C, we need to call gets() or fgets(0 method. We usually will not use scanf(0 or fscanf() because they cannot accept white spaces when scan user inputs. But when we specify the format in scanf() function, we may read strings with white space. the code section below illustrate this:#include <stdio.h> int main(int argc,char **argv){ char name[30]; fprintf(stdout,"Please enter the name : \n");fscanf(stdin,"%[^\n]s",name); fprintf(stdout,"%s\n",name); return 0;} On a...
20,865 0 C SCANF WHITE SPACE STRING FORMAT