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
+ 0 comments #include <cmath> void update(int *a,int *b) { // Complete this function int c = *a; *a += *b; *b = abs(c - *b); }
+ 0 comments void point(int *a,int *b) { int *c; *c=*a; *a=*a+*b; *b=abs(*c-*b); }
+ 0 comments Here are the solution of Pointer in C++ Hacker Rank Solution
+ 0 comments void update(int *a,int *b) { // Complete this function
int x; int y; if(*a > *b){ x = (*a + *b); y = (*a - *b); *a = x; *b = y; } else { x = (*a + *b); y = *b - *a; *a = x; *b = y; }}
+ 0 comments include
include
void update(int *a,int *b) { // Complete this function
int *c,*d; *c=*a; *a=*c + *b;
*b = abs(*c - *b);}
int main() { int a, b; int *pa = &a; int *pb = &b;
scanf("%d %d", &a, &b); update(pa, pb); printf("%d\n%d", a, b); return 0;
}
Load more conversations
Sort 990 Discussions, By:
Please Login in order to post a comment