problem 1: How does a structure distinct from an array? Describe your answer with simple illustrations.
problem 2: Describe how a structure distinct from a union? describe your answer with simple illustrations.
problem 3: prepare 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 (ex: S – small, M – medium, L - large and XL- extra large)
problem 4: Describe what a nested structure is. Describe your answer with an appropriate ex.
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.
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.