Ask Question
15 July, 12:50

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

+3
Answers (1)
  1. 15 July, 15:56
    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 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