Question: (1.A) Write a C program that creates a structure type with two members according to the following criteria: The first member is a Social Insurance
(1.A)
Write a C program that creates a structure type with two members according to the following criteria:
The first member is a Social Insurance number of 9 digits. The second member is a structure with three members. Its first member contains a first name, its second member contains a middle name, and its final member contains a last name. Here they are,
typedef struct{
char first[20];
char middle[20];
char last[20];
}name;
typedef struct{
char sin[10];
name FullName;
}person;
Create and initialize an array of five such structures. Have the program display the data in the following form
Dribble, Flossie M. 234321914
Only the initial of the middle name is displayed, and a period is added. Neither the initial (of course) nor the period should be displayed if the middle name member is empty.
Write a function to do the printing, and pass the structure array to the function. Here is the function prototype,
void print_info(person a[], int n);// n is the size of array a
(1.B)
Modify the C program in 7.1 by passing a pointer to the function instead of a structure array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
