+ 2
Why giving different value of 1st and 5th even if same pointer and everything same .
5 Answers
+ 1
Increments applying on pointers, not on it's contents.
Post fix operator has highest precedence than *dereference operator.
so It's evaluated *p++ as *(p++) , and it's a post increment operation so first value is used in print after then increments..
pre fix operator and dereference has same precedence but associativity is right to left.
so *++p is evaluated as *(++p) => *(p=p+1)
+ 2
Observe that p gets incremented twice by lines 12 and 13. Now p is two positions higher than it started out, so it points to the third element, which holds the value 2.
+ 2
Yes. Because p is in scope within all of main(), if you change it anywhere in main() (even in a function argument) then the change remains in effect thereafter - until the next change.
+ 2
Ok thanks
+ 1
Brian So in pointer specific print also chang value of another coming ?