Today I faced an interview in which one question was very tricky for me. Interviewer said "how to make constant able to change its value?"
I replied "using pointer" and I shown him an example :
int main( void )
{
const int a = 3;
int *ptr;
ptr = (int*)( &a );
printf( "A=%d\n", a );
*ptr = 5;
printf( "A=%d\n", a );
return 0;
}
But he said this is fine. But tell me which is property which makes constant non changeable? and he also said that there is one property which we can change and make constant changeable.
Is there any property like that? How does it work?