Skip to content

Commit 249d874

Browse files
committed
swap pointers
1 parent 6848713 commit 249d874

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

swapusingpointers

8.35 KB
Binary file not shown.

swapusingpointers.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include<stdio.h>
2+
3+
void swap(int *a, int *b)
4+
{
5+
int temp;
6+
temp = *a;
7+
*a = *b;
8+
*b = temp;
9+
}
10+
11+
int main()
12+
{
13+
int a=2,b=3;
14+
printf("a %d, b %d\n",a,b);
15+
16+
swap(&a,&b);
17+
printf("a %d, b %d\n",a,b);
18+
return 0;
19+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy