Skip to content

Commit b6cc99f

Browse files
authored
Merge pull request #72 from SamiNasry/fix-c-code-error
Logic Error fixed in Solution
2 parents c9532ab + 12eb91d commit b6cc99f

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

chapter_2/exercise_2_02/loop.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@ int main(void)
1919
{
2020
char c = getchar();
2121

22-
if (i >= (MAXLINE - 1))
23-
{
24-
loop = 0;
25-
}
26-
else if (c == '\n')
27-
{
28-
loop = 0;
29-
}
30-
else if (c == EOF)
22+
if (i >= (MAXLINE - 1) || c == '\n' || c == EOF)
3123
{
3224
loop = 0;
3325
}

0 commit comments

Comments
 (0)