Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Give the minimum size of each of the following C data structures, assuming that

ID: 3816482 • Letter: G

Question

Give the minimum size of each of the following C data structures, assuming that char values occupy one byte, int and float values occupy four bytes, double values occupy eight bytes, and pointers occupy four bytes. (a) char str [] = "Curly"; (b) double *a [4] [4]; (c) char *str[3] - {"Moe", "Larry", "Curly"}; (Include the space occupied by the string literals in your answer.) (d) union {int a; char b; float c[4];} u; (e) struct {int a; char b; float c[4];} a; (f) union {int a[3]; double b; struct {float c; char d[4];} s;} u; (g) struct {float a; union {double b[2]; int c;} u; char d;} s;

Explanation / Answer

4

a) size will be 6 bytes, 5 for charcters "CURLY" and sixth for '' ending this string.

b) size will be 128
there are 16 elements and ize of double is 8, so 16*8 = 128

c) size will be 12

d) 16

e) 24

f) 16

g) 32

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote