Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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; 26Step 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