Skip to content

Commit 2c1b8e6

Browse files
authored
Update reverse.c
1 parent d50ea33 commit 2c1b8e6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

chapter_4/exercise_4_13/reverse.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ void reverse(char str[])
2727

2828
str[j++] = c;
2929
}
30-
if (str[j] == '\0') // if whole reverse process is complete, reset the static variables to make this function reusable
30+
31+
// if whole reverse process is complete, reset the static variables to make this function reusable
32+
if (str[j] == '\0')
3133
{
32-
i = 0;
33-
j = 0;
34-
}
34+
i = 0;
35+
j = 0;
36+
}
3537
}
3638

3739
// NOTE: As a simple observation when recursive functions are used, static

0 commit comments

Comments
 (0)