Ask:
Why study for more than a year of C language, still do not understand those input function usage, for example: scanf, getch,gets, etc.
For:
Summary from now on 、、、、、
Ask:
It is too late to sum up these basic knowledge, and the others have become great gods.
For:
It's never too late to be aware of your flaws.
"scanf":
1. scanf input integer, with int, float type with%f, double type with%LF.
2. scanf ("%c", ch);
At this point, whether you enter a carriage return, a space, or a tab, it will count as the input of Ch.
3.SCANF ("%s", string);
%s Enter a string with a space, carriage return, tab end, for example: type She is a good girl, then the result of string is she.
and the spaces do not count as string characters.
Add: The mark at the end of string is "".
Char string[100];
scanf ("%s", string);
for (int i=0;string[i]!= ' n '; i++)
printf ("%c", String[i]);
return 0;
If the end condition of the string is changed to "\ n", garbled text will appear because the end condition is not \ n.
Another problem is that you can't enter strings with scanf ("%c", &string[i]).