Originally Posted by
hex_dump
doesn't the ++ operator have higher precedence... As it stands it starts printing from (string + 0).
It does have higher precedence, but this is the correct behaviour for the code you posted. Remember that with postfix ++ (i.e. ++ after the operand like"some_string++") its operand is first used and then incremented - the increment only happens *after* its value is taken. With prefix ++, it is first incremented, then the (newly incremented) value is used.
As a more concrete example:
Code:
int post_a = 2;
int post_b = post_a++; // post_a++ yields value of post_a *before* it was incremented.
// At this point, post_a = 3, post_b = 2.
int pre_a = 2;
int pre_b = ++pre_a; // ++pre_a yields value of pre_a *after* it gets incremented.
// At this point, pre_a = 3, pre_b = 3.