Consider the following C declaration struct { short s[5]; union { float y;…

PYQ GATE 2000

Consider the following C declaration 

struct 
{
    short s[5];
    union 
    {
        float y;
        long z;
    }
    u;
}t;


Assume that objects of type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is

  1. A.

    22 bytes

  2. B.

    18 bytes

  3. C.

    14 bytes

  4. D.

    10 bytes

Attempted by 930 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…