-
Andre Maroneze authoredAndre Maroneze authored
pointer_arith_algebraic_properties_3_global.c 285 B
int y[2], x[2];
int main() {
int *p=(int*)(
(((uintptr_t)&(x[0])) + ((uintptr_t)&(y[1])))
-((uintptr_t)&(y[0])) );
*p = 11; // is this free of undefined behaviour?
//(equivalent to the &x[0]+(&(y[1])-&(y[0])) version?)
printf("x[1]=%d *p=%d\n",x[1],*p);
return 0;
}