One way in which a structure differs from an array is that

a structure may have members of more than one type
a structure must have members that are all the same type
an array may have members of more than one type
there is no difference between a structure and an array

The correct answer is A. A structure may have members of more than one type.

A structure is a data type that can store multiple data items of different types. An array is a data type that can store multiple data items of the same type.

For example, a structure could store a person’s name, age, and address. An array could store a list of numbers.

Here is an example of a structure in C:

struct person {
char *name;
int age;
char *address;
};

Here is an example of an array in C:

int numbers[] = {1, 2, 3, 4, 5};

As you can see, the structure can store data of different types, while the array can only store data of the same type.

Option B is incorrect because a structure does not have to have members that are all the same type.

Option C is incorrect because an array cannot have members of more than one type.

Option D is incorrect because there is a difference between a structure and an array.

Exit mobile version