Why can't I do *value++; to increment one to the value in that memory location?
c++, pointers
Solution
`value` is a pointer to an integer. The rules of pointer arithmetic say that if you do an operation like `value++`, then afterwards it will point to `value + sizeof(int)` (in terms of bytes).
What's happening here is you would be dereferencing `value` to get some rvalue which you just throw away, and then incrementing `value` (not the thing it's pointing to, rather, the pointer itself).
Problem
I understand that for it to works it needs to be ``` void increment(int *value) { (*value)++; } ``` This is because it needs brackets due to how precedence works (correct me if i'm wrong). But how come when I do the following, no compile error happens? The value isn't changed which is to be expected because there are no brackets, but what exactly is this changing? ``` void increment(int *value) { *value++; } ```