Which is an incorrect declaration of one dimensional array ?
int x[5];
int x[5]={1,2,3,4,5};
int x[5]={1,2};
int x[];
Answers
Answered by
4
Answer:
x(5)=(1,2,3,4,5)
Explanation:
Answered by
0
int x[5]={1,2}; ⇒ is an incorrect declaration of one dimensional array.
One dimensional array :
- Before using an array variable in a program, it must be declared. A data type (int, float, char, double, etc. ), variable name, and subscript must all be included in the declaration. The array's size is represented by the subscript.
- The first index in an array is always 0. We can declare a one-dimensional array and store values or elements at the moment of declaration, as seen below: declare marks[] and initialize with five values.
- int marks[5] = { 9,7, 5, 6, 1 }; declare marks[] and initialise with five values.
Similar questions