今天我读了一个让我感到困惑的C片段:
#include <stdio.h>
int
main(void)
{
int a[] = {0, 1, 2, 3};
printf("%d\n", *(*(&a + 1) - 1));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在我看来,&a + 1
毫无意义,但它运行没有错误.
有人可以解释一下这意味着什么,谢谢.K&R C圣经是否涵盖了这一点?
UPDATE0:读完答案后,我意识到这两个表达式主要让我困惑:
&a + 1
,在SO中被问到:关于c中的表达"&anArray"
*(&a + 1) -1
,这与阵列衰减有关.