C Standard Libraries C++

getchar()

Declaration

int getchar();

Description

This function read a character from the standard input stream, "stdin," returns the read character and advances the stream pointer. If the function is not successful, it returns EOF.

Example

#include <cstdio>

int main()
{
    // Read the first typed in character.
    int iRet = getchar();
    printf("The first character you typed: %c\n", (char)iRet);

    return 0;
}

Output

getchar() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.