It may be stupid question, but i’m confused. That’s why i’m clearing my doubt. yesterday, during my interview i got one question like
char ch="Hello";
printf("%d",printf("%s",ch));
I thought printf is a void type function, because i never seen printf function to assign to any variable. So, i told, it will show compile error. Since, compiler won’t find return type printf function. But, i was wrong. And the output is Hello5. I’m really confuse, how this comes.
The function fun() is returning an int, you are just not assigning it to anything. So the return value is being discarded as it is not assigned to anything.
printf by the way, is not a void function but returns the number of characters printed, which is 5 in case of “Hello”.