This is my code:
#include<stdio.h>
int main()
{
int i;
float f;
char c;
scanf("%d", &i);
scanf("%f", &f);
scanf("%c", &c);
printf("The integer value: %d \n", i);
printf("The floating point value: %f \n", f);
printf("The character value: %c \n", c);
return 0;
}
When I ran this code, only scanf for i
and f
worked. But scanf for c
not worked and it skipped to the next print function.
42
3.152
The integer value: 42
The floating point value: 3.152000
The character value:
Process returned 0 (0x0) execution time : 6.871 s
Press any key to continue.
I can't find any solution for this problem. Is it a bug of compiler?