176k views
1 vote
Every element in an array always has the same data type. Necessary ?

User Rahil Ali
by
6.8k points

1 Answer

6 votes

Answer:

False.

Step-by-step explanation:

Every element in the array is always have same data type.

Array is the collection of items of same data type stored in contiguous memory location.

So as the definition suggests that array elements always have same data type.

But it is not necessary there are some languages that can allow array elements to be different types such as javascript,python.But traditional languages such as C,C++,Java does not allow this.

User Cezar Halmagean
by
6.7k points