summaryrefslogtreecommitdiffstats
path: root/3/3.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-03 18:37:49 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-03 18:37:49 +0800
commit978d67e63bf6f149cc4ae082f9643bce77ab3f3a (patch)
tree5d9f4457bcf0c7b3be5d3236e808d08e64a6e245 /3/3.c
parenta7cc187e2090a2cfa866dff07e6bbf703f06e2c8 (diff)
downloadk&r-exercises-978d67e63bf6f149cc4ae082f9643bce77ab3f3a.tar.gz
3.3
Diffstat (limited to '3/3.c')
-rw-r--r--3/3.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/3/3.c b/3/3.c
index 3921e02..c9721f2 100644
--- a/3/3.c
+++ b/3/3.c
@@ -24,9 +24,9 @@ void expand(char s1[], char s2[]) {
int i, j, c;
for (i = 0, j = 0; j < MAXLEN - 1 && (c = s1[i]) != 0; i++) {
- if (c == '-' && i > 0 && isalnum(s1[i - 1]) && isalnum(s1[i + 1])) {
- c = s1[i - 1] + 1;
- while (c < s1[i + 1])
+ if (c == '-' && i > 0 && isalnum(s1[i-1]) && isalnum(s1[i+1])) {
+ c = s1[i-1] + 1;
+ while (c < s1[i+1])
s2[j++] = c++;
continue;
}