I thought that the &
operator wouldn't work for constants because I thought their invokations are replaced with their values at compile time like with macros and that they're rvalues. I wrote this test and the output suprised me.
#include<stdio.h>
int main(void){
const int a=1;
*(int*)&a=2;
printf("%i%i",a,*&a);
return 0;
}
It outputs 12. I expected it to be 11. Thanks for reaching out.