175k views
2 votes
Suppose v is an array with 100 int elements. If 100 is assigned to v[100], what happens?

Answer
(A) The compiler issues an error message.
(B) The compiler issues a warning message.
(C) An exception will be thrown when that statement is executed.
(D) Another variable or array will be unexpectedly modified.

1 Answer

4 votes
If 100 is assigned to v{100}, an exception will be thrown when that statement is executed. The correct answer is C. 
User Mene
by
7.8k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.