I’m trying to increment pointer. I was sure that it is similar to do i+=1
, but I’m getting adress.
#include \"stdafx.h\"
#include
You have used *a++;
As your increment operator ++
has higher precedence than your pointer *
, what actually is happening is that your pointer address is being incremented. So the new *a has no defined value and hence it will give an undefined value
*a++;
is the equivalent of a++;
To fix this you can use parentheses (*a)++;
or simply us pre increment operator ++*a;