You can actually try:
volatile const int num=5; int *pNum=(int*)# *pNum=40; std::cout<<num<<endl;