Question 1: How does a structure distinct from an array? Describe your answer with simple illustrations.
Question 2: Describe how a structure distinct from a union? Explain your answer with simple illustrations.
Question 3: Write sample code to declare a union named 'clothes'. The union has two variables 'shirt' and 'blouse' and its members are:
Manufacturer of type character and size 20
Cost of type float
Size of type character (example: S – small, M – medium, L - large and XL- extra large)
Question 4: Describe what a nested structure is. Describe your answer with an appropriate example.
Question 5:
a) Define a structure comprising of two floating point members called real and imaginary. Comprise a tag called complex in the definition.
b) Declare three variables x1, x2 and x3 of be structures of type complex.
c) Assign the initial values of 1.3 and -2.2 to the member’s x.real and x.imaginary, correspondingly.
d) Declare a pointer variable px to point to a structure of type complex.
e) Declare a one-dimensional 100-element array called cx whose elements are structures of the type complex.
f) Combine the structure definition and the array declaration of part (v) into one single declaration.
g)
i) Define a union called 'dateTime' that contains three members: hour, minute and second.
ii) Define a structure called 'calendarDate' that contains three integers members: day, month and year and a member time1 of type dateTime.
iii) Declare a variable date1 of type 'calendarDate'.
iv) Set the time of date1 to: 10:30:25.