- 2
#include <stdio.h> int main() { int x[5] = {20, 45, 16, 18, 22}; printf("The element is %d\n", x[5]); /* 32766 */
Can someone tell me how the index value of 5 in coming as 32766...
3 Antworten
+ 4
Er, 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).
+ 1
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.
+ 1
Ohky thanks 😊