We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77b2330 commit dfb993fCopy full SHA for dfb993f
chapter_1/exercise_1_19/reverse.c
@@ -31,7 +31,7 @@ int get_line(char line[], int max_line_len)
31
++i;
32
}
33
34
- // flush out input stream if exceeding MAXLINE limit
+ // flush out input stream if exceeding max_line_len limit
35
while (i >= max_line_len - 1 && (c = getchar()) != '\n')
36
;
37
@@ -62,7 +62,15 @@ void reverse(char line[])
62
int i_back = length(line);
63
char temp;
64
65
- i_back = line[i_back - 1] == '\n'? i_back - 2: i_back - 1;
+ if(line[i_back - 1] == '\n')
66
+ {
67
+ i_back -= 2;
68
+ }
69
+ else
70
71
+ i_back -= 1;
72
73
+
74
while (i_back > i_front)
75
{
76
temp = line[i_front];
0 commit comments