kumardashish's Avatar, Join Date: Nov 2008
Go4Expert Member
hi..
your first program gives a warning because you r trying to store the address of const int variable into int type pointer.
here is the warning::" different 'const' qualifiers"
this is the reason you can change the value of const variable.if you create const type pointer variable then it gives an error : l-value specifier...
try this code..
Code:
void main()
{
    int const i=123;
    int *const ip;
    
    /* Changing constant integer i.e. const int/int const */
    
    printf(" %d %x \n",i,&i);
    ip=&i;
    *ip=456;
    printf(" %d %x %x %d \n",i,&i,ip,*ip);
    
}

Last edited by kumardashish; 21Oct2010 at 15:16..
itharsh_04's Avatar, Join Date: Oct 2010
Newbie Member
hi,
i like this formum
pl write & write all suggestion on my Eid itharsh_04@yahoo.com