You are viewing a single comment's thread. Return to all comments →
Simplest solution is below,
using namespace std;
void update(int *pa,int *pb){ int temp = *pa; *pa = *pa + *pb; *pb = temp > *pb ? temp - *pb : *pb-temp; }
int main(){ int a,b; cout <<"Enter a & b: "; cin >>a>>b; update(&a,&b); cout <<"sum: "<
Seems like cookies are disabled on this browser, please enable them to open this website
Pointer
You are viewing a single comment's thread. Return to all comments →
Simplest solution is below,
include
using namespace std;
void update(int *pa,int *pb){ int temp = *pa; *pa = *pa + *pb; *pb = temp > *pb ? temp - *pb : *pb-temp; }
int main(){ int a,b; cout <<"Enter a & b: "; cin >>a>>b; update(&a,&b); cout <<"sum: "<