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
Difference between function and formula in Excel
8 little-known Excel functions that can save you a lot of work
How to use the NORMDIST function in Excel - Function that returns the distribution in Excel
Date functions in Excel, DAY, WEEKDAY, MONTH
How to use the SUMIF function in Excel to calculate the sum based on conditions
How to use the Round function in Excel to round numbers and process data