The correct answer is: Structure variable.
A structure variable is a data type that can store multiple variables of different data types. This is useful when you need to pass a group of related variables to a function or method. For example, if you have a function that needs to know the name, age, and address of a person, you could create a structure variable to store these three pieces of information.
The syntax for declaring a structure variable is as follows:
struct {
type member1;
type member2;
type member3;
} variable_name;
For example, the following code declares a structure variable called person
that can store three variables of type string
:
struct {
string name;
int age;
string address;
} person;
Once you have declared a structure variable, you can access its members using the dot notation. For example, the following code prints the name of the person stored in the person
variable:
cout << person.name << endl;
You can also assign values to the members of a structure variable. For example, the following code assigns the values “John Doe”, 30, and “123 Main Street” to the members of the person
variable:
person.name = "John Doe";
person.age = 30;
person.address = "123 Main Street";
Structure variables are a powerful tool that can be used to store and manage groups of related data. They are often used in conjunction with functions and methods to pass data to and from these constructs.
Here is a brief explanation of each option:
- A. Structure variable is a data type that can store multiple variables of different data types.
- B. Variable is a placeholder for a value.
- C. Auto variable is a variable that is automatically created and destroyed by the compiler.
- D. Constant variable is a variable whose value cannot be changed.