Hi……..can any one help plz..
I want to know clear difference between them…
Const int *p
Int const *p
Int * const p=&i
Const int *const p=&j
Int const * const p=&k
Const int arr[]={1,2,3,4};
Void func(cons t int&)
Void func (cons t int *p)
firstly, pointers
secondly, don't capitalize keywords
now, constint *p a pointer to a constant integer. value of p cand be modified. value of *p, cannot.
intconst *p the same
int * const p=&i a constant pointer to an integer i. value of p cannot be modified, but value of *p can.
constint *const p=&j a constant pointer to a constant integer j. neither p nor *p can be changed.
intconst * const p=&k the same
constint arr[]={1,2,3,4}; an array of constant integers. no element can be modified
void func(constint&) a function which takes a reference to a constant integer. note: reference itself is basically a constant pointer.
void func (constint *p) a function which takes a pointer to constant integer.
Note, however, that even though a reference is pretty much a constant pointer, it does not require dereferencing. If you have int& j = i;, you don't need to use *j. You can use j just like a normal variable like i.