CPlusPlusThings/basic_content/volatile/volatile.cpp
Light-City 8edbbbc5a2 update
2019-11-05 16:56:07 +08:00

17 lines
298 B
C++

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