Yesterday i was reading about comma operator from
yashvant kanetkar book. When i went through this program, it appeared 100 %
correct. But i was wrong :(.
#include <stdio.h>
int main()
{
int
a =
1,2;
printf("a : %d\n",a);
return
0;
}
If you think you really know c programming. Then i want to
challenge you. Can you tell the output of this program givenn below. Also tell
me is it valid or invalid.
#include <stdio.h>
int main()
{
int
i=45;
printf("%d\n",printf("%d",printf("%d",i)));
return
0;
}
This comment has been removed by the author.
ReplyDeleteSmall correction in Q1: int a = (1,2); instead of ::int a = 1,2; Assignment happens from right.
ReplyDeleteQ2: Printf function returns string count.