diff options
Diffstat (limited to '')
-rw-r--r-- | ch2/2-03_hex-to-int.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ch2/2-03_hex-to-int.c b/ch2/2-03_hex-to-int.c index 566bd75..4985bc5 100644 --- a/ch2/2-03_hex-to-int.c +++ b/ch2/2-03_hex-to-int.c @@ -25,16 +25,15 @@ int htoi(char s[]) { int i, val; - for (i = val = 0; isxdigit(s[i]) || toupper(s[i]) == 'X'; ++i) { if (toupper(s[i]) == 'X') { continue; } if (s[i] > '9') { val = 16 * val + (toupper(s[i]) - '7'); - // The 7 is because 'A' is 7 higher than '9' in ASCII and thus only needs - // to be knocked down by that much to fall in line with the normal integer - // conversion + /* The 7 is because 'A' is 7 higher than '9' in ASCII and thus only needs */ + /* to be knocked down by that much to fall in line with the normal integer */ + /* conversion */ } else { val = 16 * val + (s[i] - '0'); } |