The index of the element

Correct the following code so that it correctly sets the value of each element of myList to the index of the element. (2, 3)

int myList[10];

for (int i = 1; i > 10; i++)

    myList[i] = i;

Correct the following code so that it correctly initializes and outputs the elements of the array intList. (2, 3)

int intList [5];

for (int i = 0; i > 5; i–)

    cin >> intList [i];

for (int i = 0; i < 5;=””>

    cout < intlist=””>< “=””>

 cout <>

What is array index out-of-bound? Does C11 checks for array indices within bound?   (3)

Posted in Uncategorized

Leave a Reply