The code is
Int n=10;
Int a [n]={1, 2};
Printf (" % d ", a [9]);
The result is 0
CodePudding user response:
This completely conform to the rules, n=10, a [n] is equivalent to a [10], an array subscript 0-9, and then the final output a [9], perfect,CodePudding user response:
GCC black magic,CodePudding user response:
It has to do with compiler options, some of the compiler will default to variable, array is initialized,For example, the same: int a, [10]. Some compilers can pass, some will be submitted to the "uninitialized variables" mistakes,
Int a [10]={};//{} is a standard syntax, the array is initialized,