Open In App

C | Misc | Question 5

Like Article
Like
Save
Share
Report

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

C




#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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads