Question: 1 We will repeat the program from last week, except this time, instead of reading the file into an array of ints, we will read

 1 We will repeat the program from last week, except this

time, instead of reading the file into an array of ints, we

1 We will repeat the program from last week, except this time, instead of reading the file into an array of ints, we will read it into an array of structs. You will need to complete the below program to read each line of the file into the memarray struct values foo and bar, and then add code to print out the contents of the memarray structs. #include ?nclude struct mydata ( int fooi int bari int main (int argc, char *argv) if (argc - 2) filename ", printf ("%s exit (0) argv[0]); FILE *fp fopen (argv [1], "r"); if (fpNULL) perror ("Could not open file") exit (0) int num rows ? 0; struct mydata memarray - malloc (10+sizeof (struct mydata))

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!