The function getc () in C
The function int getc (FILE * stream) in C Library standard takes the next character (an unsigned char) from the given Stream and increases the position indicator for that Stream.
The function int getc (FILE * stream) in C Library standard takes the next character (an unsigned char) from the given Stream and increases the position indicator for that Stream.
Declare getc () function in C
Below is the declaration for the getc () function in C:
int getc ( FILE * stream )
Parameters
stream - This is the pointer to a FILE object that identifies the Stream on which the operation is performed.
Returns the value
This function returns the character read as an unsigned char that is cast to an int or EOF or an error.
For example
The following program C illustrates the usage of the getc () function in C:
#include int main () { char c ; printf ( "Nhap ky tu: " ); c = getc ( stdin ); printf ( "Hien thi ky tu vua nhap: " ); putc ( c , stdout ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: Function fputs () in C
Next lesson: getchar () function in C
5 ★ | 1 Vote
You should read it
Maybe you are interested
How to turn a photo into a painting using the Generative Fill function in Photoshop
How to use the TREND function in Excel
Google Sheets Functions to Simplify Your Budget Spreadsheets
Instructions for using the TRIMRANGE function to clean up Excel tables
How to master numerical data in Google Sheets with the AVERAGE function
Don't buy headphones if they lack this important function!