I use DevCpp, just curious and want to know why this 2 is different,
char ch_1=getchar ();
printf ("getchar: %d\n", ch_1);
char ch_2=getch ();
printf ("getch: %d\n", ch_2);
I pressed "Enter" 2 times
getchar: 10
getch: 13
It produced 10 and 13, which means getchar
produces 10 (ascii of \n
) and getch
produces 13 (ascii of \r
). Why is it different? Why not both 10 or both 13? Why getch
produces carriage return while getchar
produces new line?