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

  1. 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)
  2. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!