diff --git a/c/ex3.c b/c/ex3.c index d69287a..84ff9a3 100644 --- a/c/ex3.c +++ b/c/ex3.c @@ -26,7 +26,7 @@ void reverse_bytes(unsigned char* buf, size_t n) { buf[i] = reverse_byte(buf[i]); } - for (size_t i = 0; i <= (n / 2); ++i) { + for (size_t i = 0; i < ((n + 1) / 2); ++i) { swap_bytes(&buf[i], &buf[n - 1 - i]); } }