Let's see the first code:
The following code displays the value of n=10
:
#include<iostream>
int main()
{
int n=10;
int*p=&n;
*p++;
std::cout<<n;
return 0;
}
The following code displays the value of n=11
:
#include<iostream>
int main()
{
int n=10;
n++;
std::cout<<n
return 0;
}
p++
increments the pointer. You would need (*p)++
to increment the value.