Open In App

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:

The output of the given code is 4. This result is obtained by using the sizeof operator on the return value of the function fun(). The function returns an integer (10), and the size of an integer is 4 bytes.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :