Basically, it depends on the compiler. Most probably the char will get on stack and will not be readonly (so, const
would mean just mess with type conversions, nothing in the executable). The stack is never readonly.
If you define some const
as a global, it would most probably get into DATA
segment which is not readonly either. So you will again get it all working. Though I can imagine the compiler putting all consts into a special segment with readonly access, in which case you will get a usual access violation/segfault.
Also, you may have a clever compiler that would optimize entire code and replace any occurences of const variable name by its value, and in that case nothing can be told about modifying this variable. Well, most probably the compiler would be clever enough to see &c
to understand that the variable must be stored somewhere.
Note the multiple most probably and maybe. Undefined behavior is undefined behavior, so this answer is to be read as we don't know what will happen.