/* Demonstrate that you should place a SPACE before the %c in a scanf(). This will filter out white spaces before reading the character. */ #include main() { int x, y, z; char ch; printf("Enter x:"); scanf("%d", &x); printf("Enter y:"); scanf("%d", &y); printf("Enter z:"); scanf("%d", &z); printf("Enter ch:"); scanf(" %c", &ch); /* Note that there is a SPACE before the %c */ printf("[%d] [%d] [%d] [%c]\n", x, y, z, ch); }