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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:50, shadow29916
What is a rush associated with alcohol?
Answers: 1
image
Computers and Technology, 23.06.2019 00:00, addisonrausch
What season was better from fortnite?
Answers: 2
image
Computers and Technology, 23.06.2019 09:30, Princessirisperez0
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e. g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
image
Computers and Technology, 23.06.2019 12:50, tommy4260
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
You know the right answer?
IN C language: This problem relies on the following struct definition:typedef struct Employee{char *...

Questions in other subjects:

Konu
Social Studies, 17.12.2020 14:30