I am a beginner to C and this is the dumbest question..Confused about getchar() function
- by happysoul
Sorry if I am not supposed to post beginner level questions here..I am new to this site
Please read the code below first
I am confused about getchar() 's role in the following code.. I mean I know its helping me see the output window which will only be closed when I press enter key
So getchar() is basically waiting for me to press enter and then reads a single character ..
Now my question.. what is that single character this function is reading ?? I did not press any key from the keyboard for it to read
Now when its not reading anything..why it does not give an error saying hey u didn't enter anything for me to read ..lol...(told u its a dumb question)
#include <stdio.h>
int main()
{
printf( "blah \n" );
getchar();
return 0;
}