Where does a const
variable gets stored exactly and how does it behaviour change? Say for example:
const int i=10; // stores where ?
main()
The second code shouldn't compile at all. And the compilers I've here agree: gcc gives an error with -pedantic-errors (whose purpose is to turn into error some mandatory diagnostics that historically gcc hasn't considered as error), xlc gives an error as well.
If you want a reference: 6.3.16.1 in C90 standard describes when an assignment is possible:
both operands are pointers to qualified or unqualified versions of compatible types, and the type pointed to by the left has all the qualifiers of the type pointed to by the right
and c99 as a similar constraint.