see...wat do u mean by constant variable first of all???
u r actually making a variable hold a constant value in it instead of allowing it to handle multiple varibale values..rite..???
now in the program u mentioned..u made "a" variable constant..means "a" can only hold 10...so it can't take any other value not even 11..!!!
n when u created a pointer for it...look carefully...u created a pointer to "a" which is constant n which holds only 10 ..rite???
it means.. a pointer to a constant...so wat happens..even the pointer can't change the value that it is pointing to...afterall "a"-->can only hold 10....n when u r manipulating *p..u r actually trying to change "a'"s value ..so will it allow.??? no ...rite??
n "a" is nothing but the name of the memory location where 10 resides...so p=&a..makes p point to the memory location of "a"...n *p is value at &a...where that memory is locked to hold only 10 by specifying it constant...so *p=11 is error..
n refer to pointer to constant..for any better understanding..
Last edited by IndiraP; 12Dec2012 at 22:24..