开发者

in c printf() returns what [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_JS百科 Closed 10 years ago.

in c printf() returns what?


printf returns:

  • On success, the total number of characters written.
  • On failure, a negative number.


  1. Point your browser to www.google.com;
  2. Search "printf c";
  3. Almost any result you'll get will tell you:

Return Value

On success, the total number of characters written is returned.
On failure, a negative number is returned.

Was that so difficult?


It returns the number of characters printed. See man fprintf for simple questions like this.

From the man page:

These functions return the number of characters printed (not including the trailing '\0' used to end output to strings) or a negative value if an output error occurs, except for snprintf() and vsnprintf(), which return the number of characters that would have been printed if the n were unlimited (again, not including the final '\0').


The result of "printf" is the number of characters written. If a write error occurs, "printf" returns a negative number. (ANSI standard)

Even wikipedia has a whole article about printf, where you can find the different return values for different languages and times.


Exactly what it says it returns in any decent library reference

On success, the total number of characters written is returned. On failure, a negative number is returned.


Number of characters (not including the trailing \0) printed on success, negative value on failure. see man printf.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜