C programming stdio.h function - int getc(FILE *stream)

https://‮.www‬theitroad.com

The getc function is used to read a single character from a file. It is defined in the stdio.h header file.

The syntax of the getc function is as follows:

int getc(FILE *stream);

where stream is a pointer to a FILE object that specifies the input stream to be read. The function returns the character read as an unsigned char cast to an int, or EOF if the end of the file is reached or an error occurs.

The getc function is equivalent to the fgetc function, which is also used to read a single character from a file. The only difference between the two functions is that getc can be implemented as a macro in some implementations, while fgetc cannot be implemented as a macro.