C | Misc | Question 5

Assume that the size of an integer is 4 bytes. Predict the output?

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
int fun()
{
    puts(" Hello ");
    return 10;
}
  
int main()
{
    printf("%d", sizeof(fun()));
    return 0;
}

chevron_right


(A) 4
(B) Hello 4
(C) 4 Hello
(D) Compiler Error


Answer: (A)

Explanation: sizeof() is an operator, not a function. It looks like a function though.

The operands of operators need not to be evaluated. That is why fun() is not called.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.