Ask Question
16 April, 16:24

Which one of the following statements is a valid initialization of an array named somearray of ten elements? int[] somearray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int somearray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int[10] somearray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int somearray[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

+1
Answers (1)
  1. 16 April, 18:53
    0
    The answer to this question can be given as:

    The valid statement for initialization of an array is the option first which is "int[] somearray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; ".

    Explanation:

    Array is a collection of homogeneous elements. In the C programming language array can be divided into two parts that can be given as:

    1-D (One-dimensional array)

    2-D (two-dimensional array)

    The valid statement for initialization of an array is int[] somearray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; and other option is not correct that can be described as:

    In the option second, there we initialize 11 elements in array but the size of the array is fixed that is 10.

    In option three, it is not a correct syntax for declaring an array.

    In the option fourth, we initialize this type array during declaration.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which one of the following statements is a valid initialization of an array named somearray of ten elements? int[] somearray = { 0, 1, 2, ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers