• Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    eliot
    Posts: 564 from 2004/4/15
    Here the corrected code, shich should make it clear:

    #include <stdio.h>

    int main(void)
    {
    char a;

    printf("Pausing... Please enter any letter or number > ");
    scanf("%c", &a);
    printf("You entered %c\n", a);

    if (getchar() == '\n')
    printf("bingo, again!\n");

    printf("Pausing... Please enter any letter or number > ");
    scanf("%c", &a);
    printf("You entered %c\n", a);

    return 0;
    }

    To pint Newline to stdout, it should be "\n".
    There is a newline in stdin, so second scanf
    just reads it.
    regards
    eliot
  • »12.12.10 - 09:01
    Profile