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

a.) Structure inventory containing character array partName[ 30 ], integer partn

ID: 3623338 • Letter: A

Question

a.) Structure inventory containing character array partName[ 30 ], integer partnumber, floating point price, integer stock and integer reoder.

b.) Union data containing char c, short s, long b, float f, and doubled d.

c.) A structure called address that contains character arrays
streetAddress [ 25 ], city [ 20 ], state [ 3 ], and zipcode [6].

d.) Structure student that contains arrays firstName [ 15 ] and lastName [ 15 ] and variable homeAddress of type struct address from part (c).

e.) Structure test containing 16 bit fields with widths of 1 bit. The names of the bit fields are the letters a to p.

Explanation / Answer

a) struct inventory { char partName[30]; int partNumber; float price; int stock; int reorder; }; b) union data { char c; short s; long b; float f; double d; }; c) struct address { char streetAddress[25]; char city[20]; char state[3]; char zipCode[6]; }; d) struct student { char firstName[15]; char lastName[15]; struct address homeAddress; }; e) struct test { unsigned int a : 1; unsigned int b : 1; unsigned int c : 1; unsigned int d : 1; unsigned int e : 1; unsigned int f : 1; unsigned int g : 1; unsigned int h : 1; unsigned int i : 1; unsigned int j : 1; unsigned int k : 1; unsigned int l : 1; unsigned int m : 1; unsigned int n : 1; unsigned int o : 1; unsigned int p : 1; };