C | Misc | Question 9

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
#include <string.h>
int main()
{
    char a[] = {'G','E','E','K','S','Q','U','I','Z'};
    char b[] = "QUIZ";
    char c[] = "GEEKS";
    char d[] = "1234";
    int l = strlen(a);
    int o = printf("%d", sizeof((sizeof(l)+(c[5]+d[0]+a[1]+b[2]))) );
    printf("%c", a[o]);
    return 0;
}

chevron_right


Thanks to Gokul for contributing this question.
(A) 4E
(B) 8E
(C) 1234Q
(D) Compiler Dependent


Answer: (D)

Explanation: The output seems is compiler dependent. It depends on the size of return type of sizeof. The return type of sizeof is std::size_t. The size of size_t is 4 bytes in some compilers and 8 bytes in some other.

Quiz of this Question



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.