83.8k views
2 votes
Struct personalInfo { string name; int age; double height; double weight; }; struct commonInfo { string name; int age; }; personalInfo person1, person2; commonInfo person3, person4; Which of the following statements is valid in C++?

a. person2 = person4;
b. person1 = person3;
c. person2 = person3;
d. person2 = person1;

2 Answers

6 votes

Answer:

d

Step-by-step explanation:

User Raja Chakraborty
by
5.8k points
5 votes

Answer:

The answer is "Option d".

Step-by-step explanation:

  • In the given C++ language structure code two structure "personalInfo and commonInfo" is defined, inside the personalInfo structure four variable "name, age, height, and weight" is defined.
  • Then second, structure "commonInfo" is defined, which contain two variable that is "name and age" this variable datatype is same as the above structure.
  • In the next line, both structures two object is created, in which only option d that is "person2 = person1" is correct because these object holds the same value and other options are not correct because they don't hold object values.
User Latik
by
6.1k points