Alex Rivera | Logout

What does printf return?

Asked 2010-05-16T20:23:02.567
19

Today in my interview, the interviewer asked: printf is a function and every function returns something; int, void, float, etc. Now what does printf return as it's a function?

c
Edit
Report

1 Answer

8

Not every function returns something, which is indicated by using void:

void function_returns_nothing(void);

printf is a function (declared in <stdio.h>) and it returns an int, which is the number of characters outputted. If an error occurs, the number is negative.

answered 2010-05-16T20:24:17.260

Your Answer