Question: Problem 3 . Given the following declarations: typedef struct { int foo; long bar; char bazz [ 6 ] ; } somestruct _ t; typedef

Problem 3. Given the following declarations:
typedef struct {
int foo;
long bar;
char bazz [6] ;
} somestruct_t;
typedef struct {
long foo;
int count;
short fizzle;
short faddle;
} astruct_t;
struct bazz {
somestruct_t field1;
astruct_t inner [4] ;
} gribble, probarray [5] ;
somestruct_t sarray[20] ;
For this problem, assume the compiler places the array sarray at address x, the struct gribble at y, and probarray at z. Make your answers as concrete as possible (i.e., the only unknowns should be x,y and z).
a. How many bytes will be occupied by the array sarray? How much of that, if any, is padding added for alignment?
b. Is it possible to cahnge the definition of somestruct_t to reduce the amount of padding in sarray? (You may not change the types of the fields.)
c. How many bytes will be occupied by the variable gribble? (Note: the correct answer will be what is returned by sizeof (gribble).)
d. What can you say about the address of the variable gribble?
e. What is the address of sarray [3].bar?
f. What is the address of the field probarray[1].inner[2].fizzle?
 Problem 3. Given the following declarations: typedef struct { int foo;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!