diff options
Diffstat (limited to 'crazy-swap.c')
-rw-r--r-- | crazy-swap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crazy-swap.c b/crazy-swap.c new file mode 100644 index 0000000..e06136a --- /dev/null +++ b/crazy-swap.c @@ -0,0 +1,17 @@ +static inline void swap(int *a, int *b) +{ + *a=*a^*b; + *b=*b^*a; + *a=*a^*b; +} + +int main(int argc, char **argv) +{ + int i; + for (i = 0; i < 999999999; i++) { + int a = 2; + int b = 123; + swap(&a, &b); + } + return 0; +} |