C | Misc | Question 5
Assume that the size of an integer is 4 bytes. Predict the output?
#include <stdio.h> int fun() { puts ( " Hello " ); return 10; } int main() { printf ( "%d" , sizeof (fun())); return 0; } |
(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
Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.