Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming Complete the following program by: Declare an enum agegroup with 5 values: infant, children, teen, adult and elderly ; Declare a

C programming

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 "memberId", 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

// insert struct/enum declarations

typedef struct customer Customer;

typedef enum agegroup AgeGroup;

// insert the CreateCustomerRecord function

int main()

{

Customer *c;

c = CreateCustomerRecord("John Chan",1234,adult);

printf("%s %d %d ",c->name,c->memberId,c->ageGroup);

return 0;

}

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

Compare strategies to persuade an audience in a given situation.

Answered: 1 week ago