In the video Data Types, Doug says around 6:50 that printf does not have a return value. I don't think this is true. printf does return the number of character printed on the screen. Here is a question asked about the return type of printf on Stackoverflow and it give the function signature as

int printf ( const char * format, ... );

So is Doug wrong here ? Thanks

  • You are absolutely right! My opinion is that printf statements so rarely return an error that nobody takes advantage of that return value. To be honest, I've never seen code that used it.
    – Cliff B
    Apr 28 '18 at 18:07

you are right, in fact the printf function return value is as follows:

Return Value 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.

I do not know why Doug says that about printf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .