What does printf return when it succeeds?
Correct answer
C. The number of characters transmitted to the output stream
15 views
C. The number of characters transmitted to the output stream
15 views
printf returns the count of characters written, or a negative value if an output or encoding error occurs, which lets callers detect partial writes. Because the value counts characters rather than items, it doubles as a quick measure of formatted output length. puts differs by appending a newline and returning a non-negative value on success.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is C? Ask here and get an explanation.