I have a doubt regarding using getchar() to read a character input from the user.
char char1, char2;
char1 = getchar();
char2 = getchar();
I need to get 2 chars as inputs from the user. In this case, if the user enters the character 'A' followed by a newline, and then the character 'B', what will be stored in char2 - will it be the newline character or the character 'B'?
I tried it on CodeBlocks on Windows, and char2 actually stores the newline character, but I intended it to store the character 'B'.
I just want to know what the expected behavior is, and whether it is compiler-dependent? If so, what differences hold between turbo C and mingW?