I am new to C programming. While I was trying to code, I ran into this problem. Sorry if the solution is obvious and I posted it here.
#include <stdio.h>
int main(){
int T = 2;
while(T--){
c = getc(stdin);
while( (c != '\n') && (c != EOF)){
c = getc(stdin);
}
}
return 0;
}
I want that if I have several string inputs in several lines, for example,
Hithere
howareyou
Iamgood
And then, if after reading the characters “ hith ” the while loop breaks , the next character that fgetc (stdin) will read should be from the second line ( howareyou ) NOT characters from “ Hithere ”.
, 3 3 . - . , , . , , ..
. , .