Results run not to come out, have no reaction, in the original is in infinite loop...
But if the c=getchar () to break you can output a character and jump out of the loop,,
#include
Void main ()
{
int i=0;
char c;
Printf (" please enter the string: \ n ");
C=getchar ();
While (c! )
='\ n'{
i++;
C=getchar ()
}
Printf (" character number is % d ", I);
}
CodePudding user response:
Are generally not directly put getchar while conditions, from WeChat public the beauty of the language C #CodePudding user response: