Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is IN THE C LANGUAGE and ONLY the C LANGUAGE. I WILL THUMBS UP THE ANSWER IF CORRECT AND MEETS THE BELOW REQUIREMENTS!!

This program is IN THE C LANGUAGE and ONLY the C LANGUAGE. I WILL THUMBS UP THE ANSWER IF CORRECT AND MEETS THE BELOW REQUIREMENTS!! :)

PLEASE USE THE PROVIDED FUNCTIONS GIVEN BELOW! Please if possible, have comments within the code!

This program will use the following structure def for recording employee information:

struct employee {

int employee_number;

char * employee_name;

};

Using this prototype function, create a function that will make a new employee record by using dynamic memory allocation. If there is not enough memory to be used for either the employee name or the employee structure; halt the program (either by using assert or the exit command).

Here is the prototype of the function, do NOT change it:

struct employee * make_employee(int employee_number, char * employee_name);

Then by using this other prototype function, create a function that will release the system memory that has been allocated for the employee record (that was created using create_employee). Make sure this does not leak memory.

Here is the prototype of the function, do NOT change it:

void free_employee_mem( struct employee * e);

Lastly, using this other prototype function; change the name of a selected employee. Use malloc or realloc to allow for enough memory to store the new employee name. If the allocation of memory fails, return false and no NOT change the select employee name. If it worked, return true (only if them return of the employee name was true).

Here is the prototype of the function, do NOT change it:

bool employee_name_change(struct employee* e, char * new_name);

Again, I will thumbs up if the answer is correct and in the C language! Thanks again!

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

More Books

Students also viewed these Databases questions