Question
Create a function call it sampleINFO that generates sets of random data for the struct below. Note: the struct INFO is handed the address of
- Create a function call it sampleINFO that generates sets of random data for the struct below. Note: the struct INFO is handed the address of a block of memory (use pointer). The memory is then filled with the new data (strcpy)
- Create a function call it DisplayINFO that uses fprintf to display the struct to FILE *outFile. Pass the structure to your function as an argument either by address or by value.
struct INFO
{ char firstName[10];
char lastName[10];
char sex;
int age;
char position[25];
int recordNo;
} ;
char names[][10]={ "George","Ann","Renata","Betty","Sam","Vince", "Stephane",
"Ringo", "Helen","Elmer","Steve", "Aaron", "Kim", "George",
"Paul","John","Jean Luc","Colm" };
char lastNames[][10]= {"Smith","Kline","Chin","Arnold","Saxby","Jones", "Stivic",
"Michaud","Crompton","Ogilvy","Singh", "Picard", "Ngo"};
char role[][25]={"Captain","Ensign","Red Shirt","Red Shirt","Red Shirt", "Crew",
"Medical Officer","Science Officer","Crew","Crew","TransporterChief",
"Morale Officer","Crew", "Crew", "Navigator","Engineer"};
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started