What is wrong with the following piece of code?
int sample_array[10];
for (int index = 1; index <= 10; index++)
sample_array[index] = 3*index;
Error statement in the given code:
int sample_array[10];
Explanation:
Correct code:
int sample_array[11];
for (int index = 1; index <= 10; index++)
sample_array[index] = 3*index;