2019-09-27 in class
This commit is contained in:
parent
20b7254c19
commit
6b4caa8223
1 changed files with 14 additions and 0 deletions
14
swap.c
Normal file
14
swap.c
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void swap(int* a, int* b) {
|
||||||
|
*a = *a ^ *b;
|
||||||
|
*b = *b ^ *a;
|
||||||
|
*a = *a ^ *b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int a = 3, b = 5;
|
||||||
|
swap(&a, &b);
|
||||||
|
printf("%d %d", a, b);
|
||||||
|
}
|
||||||
|
|
Reference in a new issue