Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5430
Number of posts: 16951

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
o/p of: c = printf("%d%d", a, b); Posted by pnkprz on 4 Jan 2013 at 7:06 AM
int main()
{
int a,b,c;
a=b=5;
c=printf("%d%d",a,b); //line 5
printf("%d",c);
return 0
}

what will be the output of this C program..Please explain how line 5 works.
Report
Re: o/p of: c = printf("%d%d", a, b); Posted by jhavineet974 on 19 Jan 2013 at 12:03 PM
o/p=554
/*line 5-prototype and definition of printf()is defined in stdio.f file
on execution it will first print 55.on executing second printf(),since the return type of printf() is the number of characters(along with format specifier) it has printed and since here 4 values has been printed so 4 will be assigned to c and hence printed out*/



 

Recent Jobs