Question: minclude estring.hs ainclude cstdio.hs ainclude cstdib ho typedef struct String Type? thar string: ins length; ]Seringtype; typedef struct Employee I StringType ename; double salarr: J
minclude estring.hs ainclude cstdio.hs ainclude cstdib ho typedef struct String Type? thar "string: ins length; ]Seringtype; typedef struct Employee I StringType "ename; double salarr: J Rmployee: Employee" createfmpleyees(char names[l[SO], dovble "salaries, int empCount] \& 1 int mainf) f const int EMPLOrEE_coust =4 : Harray of employeei' names thar aameling[1] 50] = ("bir", "Mary", "Kevin", "Denise"): /farray ef salaries, where 15.90 is the salary of nill, 13.50 is If the salary of Mary, etc. deuble salarienl] = \{15. B0, 13.5, 20.9, 12. 99} : Employee *pEmployees a createfimployeesinametist, salaries, EMPLOVEE_counT): 1/ Print Employees int e=0 os Employee *pEmployee a pEmployees; for (e-0,e-EMPLOVEE_cOUNT;,+te) f ] ptimployeesi; I/ beallocate memory. pEmployee = pemplerees; for feut,ectMPIOVEE_COUNT; +4elf freelptimployet-sename-stringl pemployee->ename -string = NULL; Ireelptimployee-sename): afmployee-sename o NULL: pemployeed; y freelpfimployeest pemployees = NULL; return o; 1 Wrife a function createtmployees: that takes the list of employees' rames, list of their salaries, and length of the list (enpcound as the parameterh and returns a poitter to a dynamically allocated artay of Employee storing the relewast information for empCount employtes. The fonction dynamicalty allocates memary for empCoont number of employees and asiegn the fame and salaries for each of them from the input parameters. During this process, the names are stored in the donamically allocated memory of Stringivise, and abe make sure yos anien the length of the name aspropriately. Your cose should use esaa ampunt of memory needed to store the conrsponaing names. You may assume no name is longer than 49 characters. Employee" createEmployees(char names[][So], dovble "salaries, int empCount]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
