Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

Repeat Problem 954 using nitrogen as the working fluid.

Answered: 1 week ago

Question

Evaluate. 4 3 4 2

Answered: 1 week ago

Question

Divide the following complex numbers. -15+3i -3-3i

Answered: 1 week ago