From: Jérôme Benoit Date: Sun, 12 Feb 2017 19:32:02 +0000 (+0100) Subject: exo1: swap, no need to declare tmp variable if values are the same X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=749142e7f9ed03de7b6ba7ae9770c01a80ed3ef0;p=TD_C.git exo1: swap, no need to declare tmp variable if values are the same Signed-off-by: Jérôme Benoit --- diff --git a/exo1/exo1.c b/exo1/exo1.c index 11fc1fb..822d73f 100644 --- 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; }