任何人都可以請解釋我爲什麼這個代碼打印1 3 0 0 0 -1,而不是1 2 3 0 0 0?這個定義的調用工作如何?此代碼打印什麼?爲什麼?
#include<stdio.h>
#define SOMETHINGDEFINED(i) A[i%4]
int main(void) {
int i, A[6] = { 1 };
SOMETHINGDEFINED(1) = 2;
SOMETHINGDEFINED(5) = 3;
SOMETHINGDEFINED(4 + 2) = SOMETHINGDEFINED(1 + 3 + 1)--;
for (i = 0; i < 6; i++) {
printf("%d ", A[i]);
}
return 0;
}
什麼是4 + 2%4和1 + 3 + 1%4? – immibis