• Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    I don't understand why the second scanf() doesn't wait for input. I've compiled with gcc 2.95.3 and 4.4.4 just to see if that would make a difference but it doesn't. The final printf() just outputs -

    You entered

    and then the program returns to the command line.

    Code:
    #include <stdio.h>

    main()
    {
    char a;

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


    umm... Also don't know why the backslashes before the n character in the 2nd and 4th printf() calls aren't being displayed above...

    [ Edited by ausPPC on 2010/12/12 12:25 ]
    PPC assembly ain't so bad... ;)
  • »12.12.10 - 02:19
    Profile Visit Website