Home / CSE MCQs / C-MCQs :: Discussion

Discussion :: C-MCQs

  1. What is the output of the following C code(on a 64 bit machine)?

        union Sti
        {
            int nu;
            char m;
        };
        int main()

        {
            union Sti s;
            printf("%d", sizeof(s));
            return 0;
        }

  2. A.
    8
    B.
    5
    C.
    9
    D.
    4

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    Since the size of a union is the size of its maximum datatype, here int is the largest hence 4.
    Output:
    $ cc pgm7.c
    $ a.out
    4


Be The First To Comment