我期待在这里独特的例子,我试图理解为什么他的代码片段的行为方式确实对数组的引用究竟如何工作?
// uninitialized mem
char test[99999];
//
test[0] = 'a';
test[1] = 'b';
test[2] = 'c';
test[3] = 'd';
test[4] = 'e';
test[5] = 'f';
test[6] = 'g';
for (int i = 0; i < 99999; i++) {
cout << (&test[i])[i] << endl;
}
特别是,什么是在内存中发生的输出跳过一个字符?
output:
a
c
e
g
..
'&'是这里的地址的运营商。 – LogicStuff