Hi,
Im unable to to read and print the 2nd char in the following code. please help.it is not taking the 2nd input from the keyboard. I know that it is taking the new line char from the buffer instead of giving an option to enter another char. I tried using scanf, still the same prob. i tried fflush, it didnt work. please help me to solve this problem.
input :a
output: ch1=a
ch2=
Code:
#include<stdio.h>
int main()
{
char ch1,ch2;
ch1=getchar();
printf("ch1=%c\n",ch1);
ch2=getchar();
printf("ch2=%c\n",ch2);
}