N
NO_Code
Hi,
I am trying a very simple program on a linux machine. Code given below
int main{
char a,b;
printf("Enter a ");
scanf("%c",&a);
printf("Enter b ");
scanf("%c",&b);
printf("b= %c\n",b);
return 0;
}
when i run this here is what i get
Enter a: c
Enter b: b=
It only allows me to enter just one character and as soon as I press
enter the second prompt is printed along with the b= statement and the
program exits
What am i doing wrong and how can i correct this?
I am trying a very simple program on a linux machine. Code given below
int main{
char a,b;
printf("Enter a ");
scanf("%c",&a);
printf("Enter b ");
scanf("%c",&b);
printf("b= %c\n",b);
return 0;
}
when i run this here is what i get
Enter a: c
Enter b: b=
It only allows me to enter just one character and as soon as I press
enter the second prompt is printed along with the b= statement and the
program exits
What am i doing wrong and how can i correct this?