Whether the expression * ptr ++ and ++ * ptr same?

Two expressions are different. Let's look at a sample code to understand the difference between the two expressions.

Output:   101,200,101

Note:
In the above example, to two operators, both of which have the same priority, have relevance from right to left. So the above expression ++ * p equivalent ++ (* p). In other words, we can say it is a pre-increment value, the output is 101,200,101.

Output:   100,200,200

Note:
In the above example, to two operators, having a right to left both associated with the same priority. So the above expression * ++ p equivalent * (++ p). In other words, you can say it is a pre-increment address output is 100,200,200.

Guess you like

Origin www.cnblogs.com/CodeWorkerLiMing/p/11443868.html