Question: Consider the following structure declaration: This declaration illustrates that one structure can be embedded within another, just as arrays can be embedded within structures and

Consider the following structure declaration:

struct test { short *p; struct { }; short x; short y; } s; struct test *next;

This declaration illustrates that one structure can be embedded within another, just as arrays can be embedded within structures and arrays can be embedded within arrays.
The following procedure (with some expressions omitted) operates on this structure:

void st_init(struct test *st) { } st->s.y st->p st->next = A. What are the offsets (in bytes) of the

On the basis of this information, fill in the missing expressions in the codeĀ  for st_init.

struct test { short *p; struct { }; short x; short y; } s; struct test *next;

Step by Step Solution

3.31 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This problem gets you to think about structure layout and the code used to access stru... View full answer

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 Computer Systems A Programmers Perspective Questions!