Incrementing pointer not working
问题 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 <iostream> using namespace std; int main() { int i = 42; int *a = &i; *a++; cout << *a; cin.get(); return 0; } Can anybody explain why ? 回答1: ++ has a higher operator precedence than the pointer dereference operator * . So what *a++ does is to return the value of i (the old value of *a ) before incrementing the pointer value. After that expression has been evaluated