Invoking getc() and putc() with stream arguments that have side effects may cause unexpected results because these functions may be implemented as unsafe macros, and the . The stream arguments to these macros may be evaluated more than once. See PRE31-C. Do not perform side effects in arguments to unsafe macros for more information.
This does not apply to the character argument in putc(), which is guaranteed to be evaluated exactly once.
...