I think you are being confused by the parentheses. Parentheses affect the order of evaluation, but you are using post increment, which is applied at the end, no matter what order the operators are evaluated.
In your first snippet the order is clear: first you increase argv, then you dereference it. That is, you dereference the "next" element, not the current one.
In your second snippet you want to achieve the same result, and you are playing with parentheses. This is not the solution. Parentheses affect the order in which the 2 operators (
**) are evaluated, but this doesn't mean the effects are applied in that order.
For example: if you wrote
the compiler would apply
** first, dereferencing it, giving you the content, and then it would apply
++ on it (obviously
argv must be a data type which can be increased or there will be an error, but it doesn't matter here). Instead, if you write, as you did,
the increment (
++) is applied first, and then the indirection (
**). But here is the trick: post increment is still post increment. Applying the post increment here means: take the current value, and when everything is finished remember to increase it. So
argv is used as it is, without increasing it (yet), and sent to
**, which will give the current value (not the next one!). Then, after
switch has read the current element, argv is increased (post-increment), so that if your
**argv you would notice it's the "next" value.
A solution is using pre-increment:
but if you ask me, the real solution is to avoid these headaches entirely and write the code in 2 separate lines, so that it's immediately obvious what happens. As you did in your first snippet. This is the most readable style, and therefore should be the preferred choice. Then you can forget about everything: order of evaluation, parentheses, pre- vs post-increment, associativity.