Ask Question

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 };

+4
Answers (1)
  1. 14 February, 08:25
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers