119k views
1 vote
Declare a structure whose tag name is point2d and that contains exactly two fields (or members, both of type double . the first field is x and the second field is y.

User Giker
by
7.6k points

1 Answer

5 votes

In the C language, a structure is declared as follows :

struct <tag name> {

<1st member type> <1st member name>

<2nd member type> <2nd member name>

…..

<nth member type> <nth member name>

};

Thus, a structure whose tag name is point2d that contains x and y, both double, is :

struct point2d {

double x;

double y;

};

User Ali Ali
by
8.8k points