Home / Questions / Can array subscripts have negative value in C?
Explanatory Question

Can array subscripts have negative value in C?

👁 1,222 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

No. Array subscripts should not have a negative value. Always, it should be positive.


No, array subscripts cannot have negative values in C. Array subscripts are used to access individual elements of an array by specifying their position or index. In C, array indexing starts from zero, so the first element of an array has an index of 0, the second element has an index of 1, and so on.

Attempting to use a negative value as an array subscript would result in undefined behavior. It can lead to memory access errors, data corruption, or program crashes. It is important to ensure that array subscripts are within the valid range of the array size to access elements correctly and avoid unintended consequences.