Assume that a new type called POINT has been defined it is a
Assume that a new type called POINT has been defined- it is a structure consisting of two fields, x and y, both of type double. Assume two variables p1 and p2 of type POINT have been declared. Assume that p1 has already been initialized. Write a statement that gives p2 the same value that p1 has.
Solution
struct Point
{
double x;
double y;
}
int main()
{
struct Point p1;
struct Point p2;
p1.x=1.0;
p1.y=2.0;
p2=p1;
return 0;
}
