返回 C 编程中 printf() 的类型

Return type of printf() in C programing

本文关键字:类型 printf 编程 返回      更新时间:2023-10-16

关于C编程的问题众所周知,printf() 是一个在屏幕上显示的函数。

我们也知道每个函数都有一个返回类型。

所以我的问题是:

printf() 函数的默认返回类型是什么?

printf()返回成功打印出的字符数。

返回类型为 int

printf 返回 int。有关详细信息,请参阅此处。

这就是它要说的

On success, the total number of characters written is returned.
If a writing error occurs, the error indicator (ferror) is set and a negative number is returned.
If a multibyte character encoding error occurs while writing wide characters, errno is set to EILSEQ and a negative number is returned

int,它返回已打印的字符数。