From d8c0f2328cb76d1a4aff939e70aee64c25a64b8e Mon Sep 17 00:00:00 2001 From: Liam Lage <44103555+LiamLage@users.noreply.github.com> Date: Fri, 8 Oct 2021 16:58:04 +0200 Subject: [PATCH] Update htoi Add '+10' at line 55 & 57 --- Chapter2/Exercise 2-03/htoi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Chapter2/Exercise 2-03/htoi.c b/Chapter2/Exercise 2-03/htoi.c index 7d77bb9..84e3a90 100644 --- a/Chapter2/Exercise 2-03/htoi.c +++ b/Chapter2/Exercise 2-03/htoi.c @@ -52,10 +52,10 @@ unsigned long htoi(char s[]) if (c >= '0' && c <= '9') n += c - '0'; else if (c >= 'a' && c <= 'f') - n += c - 'a'; + n += c - 'a' + 10; else if (c >= 'A' && c <= 'F') - n += c - 'A'; + n += c - 'A' + 10; } return n; -} \ No newline at end of file +}