1.

Explain the type of structure defined below and calculate the number of bytes required to store the structure variable s1. [Considerthe size of int as 4 bytes and char as 1 byte] struct student { int mo, mark; char name[25]; struct date { int dd, mm, yy; }doj; }s1;

Answer»

A structure contains another structure, then it is called nested structure.

Variable nameNo. of bytes used
mo4 bytes
mark4 bytes
name25 x 1 = 25 bytes
dd4 bytes
mm4 bytes    doj
yy4 bytes
Total45 bytes

The structure vairable doj used 12 bytes and s1 used a total of 45 bytes memory.



Discussion

No Comment Found