asked 121k views
1 vote
Write C code to define a structure called date that has three fields day, month, year, all of which are ints.

1 Answer

4 votes

Answer:

The code to define a structure with the characteristics given is:

struct date {

int day;

int month;

int year;

};

Step-by-step explanation:

First you have to declare your structure using a data type struct(first line) and the name of the structure, inside brackets you define all the members of the structure and the type of each one following the next pattern:

  • struct name_struct {

type item1;

type item2;

/*...

};

Finally we get into the correct answer:

struct date {

int day;

int month;

int year;

};

answered
User Seas
by
7.5k points