Question: looking for code errors 1. Structs and Arrays (2 points) Below is a short code segment which is supposed to read in ints from the

 looking for code errors 1. Structs and Arrays (2 points) Below

looking for code errors

1. Structs and Arrays (2 points) Below is a short code segment which is supposed to read in ints from the user and store them in the array of a bar struct. It prints out the entered numbers and then returns a pointer to the bar struct. Unfortunately, there are a number of errors in this code (compile runtime, and logic). Identify at least 4 and briefly describe each error. i struct foo f 3 int array 2 int size 6 typedef struct bar too; B bar* readArray( 9 bar barr (bar ) salloc sizeof (bar) 10 (fbarr-array)int malloc( sizeof (int) 100) 11 inti-0 12 int temp; 13 14 while scan ttexp) 0)r (fbarr )temp; 15 16 17 18 19 (fbarr).sizei 20 21 printf ("Numbers entered: ) 23 print"d ", fbarr->arrayi]); 24 25 return &fbarr; 26

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!