subject

IN C language: This problem relies on the following struct definition:typedef struct Employee{char *first; // Employee's first name. char *last; // Employee's last name. int ID; // Employee ID.} Employee;Consider the following function, which takes three arrays – each of length n – containing the first names, last names, and ID numbers of n employees for some company. The function dynamically allocates an array of n Employee structs, copies the information from the array arguments into the corresponding array of structs, and returns the dynamically allocated array. Employee *makeArray(char **firstNames, char **lastNames, int *IDs, int n){int i;Employee *array = malloc();for (i = 0; i < n; i++){array[i].first = malloc( );array[i].last = malloc();strcpy(array[i].first, firstNames[i]);strcpy(array[i].last , lastNames[i]);array[i].ID = IDs[i];}return array;}a) Fill in the blanks above with the appropriate arguments for each malloc() statement. b) Next, write a function that takes a pointer to the array created by the makeArray() function, along with the number of employee records in that array (n) and frees all the dynamically allocated memory associated with that array. The function signature is as follows:void freeEmployeeArray(Employee *array, int n){

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Acase study allows a more detailed look at the life of a single subject than any other study.
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Choose the correct citation for the case which established the "minimum contacts" test for a court's jurisdiction in a case. select one: a. brown v. board of education of topeka, 347 u.s. 483 (1954). b. international shoe co. v. washington, 326 u.s. 310 (1945) c. haynes v. gore, 531 u.s. 98 (2000). d. international shoe co. v. washington, 14 u.s. code 336.
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
Answers: 2
You know the right answer?
IN C language: This problem relies on the following struct definition:typedef struct Employee{char *...
Questions
question
French, 26.11.2020 20:10
question
Physics, 26.11.2020 20:10
Questions on the website: 13722362