C | Operators | Question 21

Assume that the size of an integer is 4 bytes, predict the output of following program.

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
int main()
{
    int i = 12;
    int j = sizeof(i++);
    printf("%d  %d", i, j);
    return 0;
}

chevron_right


(A) 12 4
(B) 13 4
(C) Compiler Error
(D) 0 4


Answer: (A)

Explanation: The expressions written inside sizeof are not evaluated, so i++ is not performed.

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


1


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