top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

C: What is the return value of a printf function?

+4 votes
185 views
C: What is the return value of a printf function?
posted Nov 10, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
Return the number of characters printed (excluding the null byte used to end output to strings).

For example:

int main()
{
    printf("Num of char printed : %d\n", printf("Hello!"));
    return 0;
}

Output : Hello!Num of char printed : 6

answer Nov 10, 2014 by Arshad Khan
It will print number of charecter printed by printf function
printf("Hello");
will return 5
Similar Questions
+1 vote

Say we have program like this

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

above we are not providing a and b but program compiles and print some junk values.

Any explanation?

+3 votes
#include <stdio.h>
int main()
{
    char vowels[5]={'a','e','i','o','u'};
    int x;

    printf("Vowel Letters");
    for(x=0;x<=5;x++)
    {
         printf("\n %C",vowels[x]);
    }
}

Output

Vowel Letters
a
e
i
o
u
♣
Process exited after 0.1132 seconds with return value 3

What is the meaning of return value 3

+1 vote

Something that just sends a screen directly to the printer without having to involve Notepad or the like? I am unable to find a search function on the updated Yahoo group.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...