Ask Question
13 September, 20:34

What are 2 main differences betweenarrays andstructs?

+3
Answers (1)
  1. 13 September, 23:08
    0
    The two main differences between arrays and structures are as following according to me : -

    1. Array is collection of data elements of same data type while a structure is collection of variables of different data types.

    2. Array is a primitive data type while structure is a user defined data type.

    There are other differences also which are as following:-

    1. The size of array is fixed while the size of structure is not fixed as structure can contain different variables of different data types.

    2. array is declared as following : -

    int array [100];

    where 100 is the size of the array means it can store up to 100 integer values.

    struct class{

    int roll_number;

    char * name;

    int admission_no;

    };

    3. Traversing and searching in an array is easy and fast while it is difficult and slow in structures.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What are 2 main differences betweenarrays andstructs? ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers