Provide the definition for each of the following structures and unions:
a. Structure inventory containing character array partName, integer partNumber, floating point price, integer stock and integer reorder.
b. Union data containing char c, short s, long b, float f and double d.
c. A structure called address that contains character arrays streetAddress,city,state and zipCode.
d. Structure student that contains arrays firstName and lastName 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.
( Using Unions) Create union integer with members char c, short s, int I and long b.
Write a program that inputs value of type char, short, int and long and stores the values in union variables of type union integer. Each union variable should be printed as a char, a short, an int and long. Do the values always print correctly?
State which of the follow are true and which are false. If false, explain why.
a. The impressive functions performed by computers essentially involve the manipulation of zeros and ones.
b. People prefer to manipulate bit instead of characters and fields because bits are more compact.
c. People specify programs and data items as characters; computers then manipulate and process these characters as groups of zeros and ones.
d. A person’s zip code is an example of a numeric field.
e. A person’s street address is generally considered to be an alphabetic field in computer applications.
f. Data items processed by a computer form a data hierarchy in which data items become larger and more complex as we progress from fields to characters to bits etc.
Provide the definition for each of the following structures and unions
- Technology: C-Programming
- Code: SHC_C_100028