Skip to content

Commit

Permalink
Merge branch 'main' into patch-5
Browse files Browse the repository at this point in the history
  • Loading branch information
ohkimur authored Mar 5, 2024
2 parents c066b3f + ab4be25 commit 37865c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 0 additions & 4 deletions chapter_4/exercise_4_04/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ int getop(char s[])
s[++i] = c = next;
}
}
else
{
c = getch();
}

if (isdigit(c))
{
Expand Down
4 changes: 4 additions & 0 deletions chapter_4/exercise_4_06/variables.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,7 @@ int getop(char s[])

return NUMBER;
}
/* To prevent the variable checking in getop() from overlapping with the letter commands,
make sure you set the commands to capital letters and explicitly tell the getop() to only
check for variable-getting if the character is not capital
e.g insteat of "if (isalpha(c))" you add "if (isalpha(c) && !(c >= 'A' && c >= 'Z'))"*/
7 changes: 7 additions & 0 deletions chapter_4/exercise_4_13/reverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ void reverse(char str[])

str[j++] = c;
}

// if whole reverse process is complete, reset the static variables to make this function reusable
if (str[j] == '\0')
{
i = 0;
j = 0;
}
}

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

0 comments on commit 37865c3

Please sign in to comment.