I think program will show error because this line
const
int
*ptr = &i;// ptr is pointer which will point to the constant integer mean we can not change the change the data of the location which is pointed by ptr pointer because in this line
*ptr = 100; // we are changing the data of location which is pointed by ptr pointer. It is read only we can not modify it.
if we remove const from const
int
*ptr = &i; then I think program will run , may be 10, 20 value will be printed..
please correct me If I m wrong........