Computer Science, asked by Hashem, 1 year ago

what is the difference between array and a structure?

Answers

Answered by Anonymous
3
Array and structure both are the container data type. The major difference between an array and structure is that an “array” contains all the elements of “same data type” and the size of an array is defined during its declaration, which is written in number within square brackets, preceded by the array name. A “structure” contains all the elements of “different data type”, and its size is determined by the number of elements declared in a structure when it is defined.
Answered by digi18
2
Array is a linear data structure that contains the elements of same data types.It can also be declared at runn time.

For ex: int Number = [10];

Structure is also a li ear data type but the only difference is it can have multiple data types.
For ex:

Struct Test {

int i;
String str;
Float f;

};


Thanks
Similar questions