repositories
/
TD_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
exo1: swap, no need to declare tmp variable if values are the same
[TD_C.git]
/
exo1
/
exo1.c
diff --git
a/exo1/exo1.c
b/exo1/exo1.c
index 11fc1fb3cf72e7a0756f5a69a558296bb1aec6b7..822d73ff169a2fe9b8985e4a9eb58b3f93fe1f02 100644
(file)
--- a/
exo1/exo1.c
+++ b/
exo1/exo1.c
@@
-16,8
+16,8
@@
void xorSwap (int *v1, int *v2) {
}
void swap(int* v1, int* v2) {
- int tmp = *v1;
if (v1 != v2) {
+ int tmp = *v1;
*v1 = *v2;
*v2 = tmp;
}