From the Advanced Programming in Unix Environment:
…
The difference between
getcandfgetcis thatgetccan be
implemented as a macro, whereasfgetccannot be implemented as a
macro. This means three things:
- The argument to
getcshould not be an expression with side effects.- Since
fgetcis guaranteed to be a function, we can take its address. This allows us to pass the address offgetcas an argument
to another function.- Calls to fgetc probably take longer than calls to
getc, as it usually takes more time to call a function.…