How does volatile work with const?
问题 I have this code where as usual, value of the variable "local" stays the same cause it is a const . const int local = 10; int *ptr = (int*)&local; printf("Initial value of local : %d \n", local); *ptr = 100; printf("Modified value of local: %d \n", local); Although, when I set local as const volatile , It changes the value of local to 100. Why is that? const volatile int local = 10; int *ptr = (int*)&local; printf("Initial value of local : %d \n", local); *ptr = 100; printf("Modified value of