#include <stdio.h> int main() { int x[5] = {20, 45, 16, 18, 22}; printf("The element is %d\n", x[5]); /* 32766 */
3 Answers
New AnswerCan someone tell me how the index value of 5 in coming as 32766...
1/23/2022 4:35:51 AM
Diya Mehta3 Answers
New AnswerEr, how do you know x[6] is expected to be zero? Again, it is outside the boundary of the array. You must presume the value is unpredictable. (Though, in some cases it IS predictable if you understand memory organization).
Understand that x[5] is indexing outside the bounds of the array. You are seeing what is next in memory past the end of the array.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message