c - Is accessing a global array outside its bound undefined behavior? -
Today there was an examination in my class - reading the code and input, and the necessary answer that would appear on the screen if the program actually As a question a [4] [4]
has been declared as a global variable, and at one point of that program, it is written in the a [27] [27]
, so I responded "like something" but the teacher said that the value of a [27] [27]
of 0
Have Will
Later, I tried to check that "all unpublished golf variables" are set to " 0
" or not. Okay, this is happening true.
So now my question:
- It seems like some extra memory was cleaned and reserved for running the code. How much memory is reserved? A compiler reserved more memory Why, and what is this for?
- For all,
a [27] [27]
yes0
Edit:
that In the code, is a [4] [4]
only declared global variable and some more localized in main
.
I tried again in Devi ++, they are all 0
but this is not true in VSE, which has the highest value 0
but some have There is a random value as told by Victor.
Comments
Post a Comment