Question: ts)Write a program that reads an array of struct Each struct is circle consists of three members, x and of the sides. Your program reads
ts)Write a program that reads an array of struct Each struct is circle consists of three members, x and of the sides. Your program reads these squares from a file (user supplied from the and line) and stores it in an array of type Square (defined as a struct with three members Souare ates of the center of the uare, and the oat: x, y, and length). You must use typedef for the type Square As you do not w of fl how long the list is, use malloc and realloc to dynamically allocate the array Mallo 00 pair at a time. reallocate 100 more space into the array. Syntax: readSquare filename Complete the program below. If the file contained more points than the Continue til the entire flie is read. 2 pts: include: / 2 pts: typedef: */ /3 pts: command line argument and error handlings int main( ) - */ 2 pts: Declare array of struct using malloc: / 3 pts: Open file for reading and error handling: / / 3 pts: Read file until eof is found and error handling: / 3 pts: If no more room in the array, expand the array using realloc / 2 pts: close and return /
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
