是getchar()和putchar()函数还是宏?

我提到了两个可靠的信息来源,两者似乎对同一事物有不同的定义:

http://www.cplusplus.com/reference/clibr%E2%80%A6

http://www.ocf.berkeley.edu/~pad/tigcc/doc/html/stdio_fputchar.html

第一个来源说putchar()是一个函数,就像getchar() ,但在第二个链接中它表示putchar()是一个宏。 我的书说getchar()是一个宏。 哪个是对的?

getcharputchar是函数,但可以另外定义为宏。 它们是否取决于实施。 关于标准库函数(C99,7.1.4@1),C标准说:

标题中声明的任何函数可以另外实现为标题中定义的类似函数的宏。

有关信息,在我的mac’man getchar’上给出了这样的信息:

  The fgetc() function obtains the next input character (if present) from the stream pointed at by stream, or the next character pushed back on the stream via ungetc(3). The getc() function acts essentially identically to fgetc(), but is a macro that expands in-line. The getchar() function is equivalent to getc(stdin). 

它完全取决于它在编译器中的实现方式。