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
- Pointers in C
- Discussions
Pointers in C
Pointers in C
Sort by
recency
|
644 Discussions
|
Please Login in order to post a comment
we can use this method too:
include
void update(int *a,int *b) { int c=*a; *a += *b; *b-=c; *b=abs(*b); }
int main() { int a, b; int *pa = &a, *pb = &b;
scanf("%d %d", &a, &b); update(pa, pb); printf("%d\n%d", a, b);
return 0; }
int update(int *a,int *b){ int *temp; *a=*a+*b; *temp=*a-*b;
*b=*temp-*b; if (*b<0) *b=-*b; return 0; }