Why is it that when I use *a++
it doesn't affect my answer and gives me a warning. However it works fine with *a=*a+1
in the below code?
#include <bits/stdc++.h>
using namespace std;
void incrementptr(int* a)
{
//*a++;
*a=*a+1;
}
int main()
{
int a=10;
cout<<a<<endl;
// increment(a);
// cout<<a<<endl;
incrementptr(&a);
cout<<a<<endl;
return 0;
}