Difference between ++*ptr and *ptr++ in C++ with examples

We have to first think that the meaning of the *ptr, is pointing to the value that is being located at the address location.

Then we have to consider the below points.

++*ptr: means the value that is pointing to a particular location is incremented by one.
Which is equal to pre-increment operation

*ptr++:means that the value that is pointing to the particular address location is incremented by one.
Which behaves like the post-increment operator.

Let us see the example below:

Here we assume that the address of the integer value is 5000.

The result of the ++*ptr is evaluated as shown below

The working example for ++*ptr:

The output of the above program is:

Now go for another situation. i.e. *ptr++ and let us see how the result is
Here in the same way as we assume the address of the ptr is 5000.

The result of the *ptr++ is evaluated as shown below

The working example for ++*ptr:

The output of the above program is:

So by seeing the above examples we can easily find the differences between the ++*ptr and *ptr++ .