Quiz Entry - updated: 2026.07.10
Why does *p++ increment the pointer, not the value?
Because postfix ++ binds tighter than *, so *p++ parses as *(p++): it dereferences the old p, then advances the pointer.
// Parsed as: *(p++)
*p++
// 1. Returns current p
// 2. Increments p (for next time)
// 3. Dereferences the OLD p value
What each variation does:
int arr[] = {10, 20, 30};
int *p = arr;
// Returns 10, p now points to arr[1]
*p++
// Equivalent to: *(p++)
// Increments p first, returns 20
*++p
// Equivalent to: *(++p)
// Increments the VALUE at p (10→11), returns 11
++*p
// Equivalent to: ++(*p)
// Returns value at p (10), then increments it (→11)
(*p)++
Common idiom - copy string:
while (*dest++ = *src++)
;
// Copies char, advances both pointers, stops at '\0'