Open In App
Related Articles

ISRO | ISRO CS 2015 | Question 78

Improve Article
Save Article
Like Article

Consider the following C declaration 

struct (
short s[5];
union {
float y;
long z;

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


22 bytes


18 bytes


14 bytes


10 bytes

Answer: (B)


Here structure creates the minimum of array and union, but union only creates the minimum for only ‘long z’ which is max.
So minimum required =18.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 05 Apr, 2018
Like Article
Save Article
Similar Reads