From cc629bb645f147c7593787cb7e80634768fe59bb Mon Sep 17 00:00:00 2001 From: akashyadav112 <56403008+akashyadav112@users.noreply.github.com> Date: Thu, 10 Oct 2019 20:46:35 +0530 Subject: [PATCH] Update swap.c --- swap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/swap.c b/swap.c index d72ac47..74676da 100644 --- a/swap.c +++ b/swap.c @@ -1,5 +1,11 @@ #include +def swap(*x,*y) +{ + int temp =x; + *x=*y; + *y=temp; +} int main() { //hello world @@ -9,10 +15,8 @@ int main() printf("\nEnter Value of y "); scanf("%d", &y); - int temp = x; - x = y; - y = temp; + swap(&x,&y); printf("\nAfter Swapping: x = %d, y = %d", x, y); return 0; -} \ No newline at end of file +}