Question: Problem 3: Structures and Files (65 Points] You are asked to write a C program to store records for patients. A. First, you need to
![Problem 3: Structures and Files (65 Points] You are asked to](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f537bf7752d_62366f537bf13a0e.jpg)

Problem 3: Structures and Files (65 Points] You are asked to write a C program to store records for patients. A. First, you need to define a structure called PATIENT. This structure should have the following fields: name (string) and age (float). [5 points] // write the structure here B. Write a function fillArray that takes as input an array of structures of type PATIENT, and the size of the array (the size will be entered by the user in the main). The function asks the user for the necessary information, and stores them in the array. (15 points) void fillArray (PATIENT* Ary, int N) { // Write your code here C. Write a function SaveAdults that takes as input the array of patients and its size N, and copies all the information of adult patients (age is greater than or equal to 18) to a file named "Adults_data.txt". Of course, you have to open the file first in the correct mode. [25 points) void SaveAdults (PATIENT* Ary, int N) { // Write your code here D. In the main: a. Dynamically allocate an array of structures of type PATIENT. Note that the size N of the allocated array should be entered by the user. [15 points] b. Call the functions fillArray, then SaveAdults. [5 points] int main() { PATIENT * Ary; int N, 1; // Get N and dynamically allocate memory for the array. Check if memory successfully allocated. 1/ Call the functions fillArray, then SaveAdults return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
