CPlusPlusThings/english/basic_content/volatile/noopt_vola.cpp
2020-07-19 10:38:38 +08:00

16 lines
291 B
C++

/* Compile code without optimization option */
#include <stdio.h>
int main(void)
{
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);
return 0;
}