I don't understand the code
int c, j;
while(scanf("%i", &j) != 1)
while((c = getchar()) != '\n')
I read alot of topics and comments about getchar() function and i knew that
getchar() is just a function gets the first character of the line the user entered
Here in our example i understood that the code locks the console screen until the user
hit the enter key ...but when i run the program
->in case i typed 1 the console freezes
and in case i typed anything but 1 the console freezes too ?!
could you please explain ..
i'm new with c so be simple as you can ..