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 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Technician a says that a shop towel should never be used to clean around the flange area before replacing an automatic transmission filter. technician b says that a dimpled transmission fluid pan can be repaired. who is right
Answers: 3
question
Computers and Technology, 22.06.2019 20:10
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 24.06.2019 21:40
Clunker motors inc. is recalling all vehicles in its extravagant line from model years 1999—2002 as well as all vehicles in its guzzler line from model years 2004—2007. a boolean variable named recalled has been declared. given a variable modelyear and a string modelname, write a statement that assigns true to recalled if the values of modelyear and modelname match the recall details and assigns false otherwise.
Answers: 2
You know the right answer?
IN C language: This problem relies on the following struct definition:typedef struct Employee{char *...
Questions
question
Medicine, 14.04.2021 16:30
question
Chemistry, 14.04.2021 16:40
question
Mathematics, 14.04.2021 16:40