C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

What is the return value from printf() function?

0 votes
1,032 views
What is the return value from printf() function?
asked May 27, 2011 by carlton Sr Member (3,990 points)

1 Answer

0 votes
printf function always returns the number of characters printed. Let us understand this with an example:

    main()
    {
    int a=10;
    printf("%d",printf("%d %d %d", a,a,a));
    }

In this above program the inner printf is first called which prints value of a, three times with space between each value, 10 10 10. Total 5 characters get printed (3 value of 10 and 2 spaces).
answered May 27, 2011 by daniel Advisor (5,600 points)

Related questions

+1 vote
2 answers 576 views
+1 vote
2 answers 116 views
+1 vote
1 answer 99 views
99 views asked May 23, 2010 by anonymous
0 votes
1 answer 428 views
+1 vote
1 answer 2,310 views
...