We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- Pointer
- Discussions
Pointer
Pointer
Sort by
recency
|
1145 Discussions
|
Please Login in order to post a comment
void update(int *a,int *b) { int num1 = (*a); int num2 = (*b); num1 = (*a) + (*b); num2 = (*a) - (*b); if (num2 < 0) { num2 = -num2; } *a = num1; *b = num2;
}
void update(int *a,int *b) { int sum= (*a)+(*b); int diff= abs((*a)-(*b));
(*a)=sum; (*b)=diff; } this may help :)
Hey, this is my code. Insights would be appreciated. Happy learning!
Using Ternary Operator
`Hey guys :
include
void update(int *a,int *b) { // Complete this function
int sum = *a + *b; int sub = abs(*a - *b);
} `