C Array - C programming (MCQ) questions for Q. 27504

Q.  What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

- Published on 26 Feb 17

a. The element will be set to 0.
b. The compiler would report an error.
c. The program may crash if some important data gets overwritten.
d. The array size would appropriately grow.

ANSWER: The program may crash if some important data gets overwritten.
 

    Discussion

  • Sai    -Posted on 30 Jul 23
    If the index of the array size is exceeded, the program will crash.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)