I am trying to change the actual value of a and b in the main function. But when I use *b++ to increment the value of b. It is not working.
#include<iostream>
using namespace std;
int F(int *b,int *c ){
*b++;
*c++;
}
int main(){
int a=1 , b=2;
cout<<a<<" "<< b<<" ";
F(&a, &b);
cout<<a<<" "<< b;
}
but in 2nd Case, the code is working fine.
#include<iostream>
using namespace std;
int F(int *b,int *c ){
*b = *b+1;
*c = *c+1;
}
int main(){
int a=1 , b=2;
cout<<a<<" "<< b<<" ";
F(&a, &b);
cout<<a<<" "<< b;
}
Isn't *b++ and *b=*b+1 same?