+ 1
What will happen if we add some value in pointer which already have a address of a variable .
int v=60; int *p=&v; p+=2; cout<<p;
2 Answers
+ 2
You will increment the address.
This can be done for arrays for example. To access the next number in an array.
Otherwise the pointer will point to unused memory with just some garbage value or even to a place where it should not point to at all and may cause a crash.
So when incrementing pointers one has to be careful an know what you are doing.
+ 2
Matthias thanks i just cleared my doubt while scrolling through q/a and found that this will just change the memory location of pointer p . thanks once again for explanation