Question: Problem 2 [Revision: malloc and other C features] Let's practice using malloc as well! Complete the following program by: 1. Declare an enum agegroup with

 Problem 2 [Revision: malloc and other C features] Let's practice using

Problem 2 [Revision: malloc and other C features] Let's practice using malloc as well! Complete the following program by: 1. Declare an enum "agegroup" with 5 values: infant, children, teen, adult and elderly; 2. Declare a struct called "customer" that contains a string field "name", a integer field "memberld", and an enum agegroup field "ageGroup"; 3. Write the CreateCustomerRecord function that mallocs a new customer record and returns its reference to the caller. Be reminded that the upper/lower cases for the names are important. The framework of the program is given below. Fill it in so it will run with proper output: #include #include l/ insert struct/enum declarations typedef struct customer Customer typedef enum agegroup AgeGroup; l/ insert the CreateCustomerRecord function int main Customer "c CreateCustomerRecord John Chan",1234 adult) printfi"%s %d %dn-c-name,e->member IdeageGroup: return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!