File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -215,10 +215,6 @@ int getop(char s[])
215215 s [++ i ] = c = next ;
216216 }
217217 }
218- else
219- {
220- c = getch ();
221- }
222218
223219 if (isdigit (c ))
224220 {
Original file line number Diff line number Diff line change @@ -304,3 +304,7 @@ int getop(char s[])
304304
305305 return NUMBER ;
306306}
307+ /* To prevent the variable checking in getop() from overlapping with the letter commands,
308+ make sure you set the commands to capital letters and explicitly tell the getop() to only
309+ check for variable-getting if the character is not capital
310+ e.g insteat of "if (isalpha(c))" you add "if (isalpha(c) && !(c >= 'A' && c >= 'Z'))"*/
Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ void reverse(char str[])
2727
2828 str [j ++ ] = c ;
2929 }
30+
31+ // if whole reverse process is complete, reset the static variables to make this function reusable
32+ if (str [j ] == '\0' )
33+ {
34+ i = 0 ;
35+ j = 0 ;
36+ }
3037}
3138
3239// NOTE: As a simple observation when recursive functions are used, static
You can’t perform that action at this time.
0 commit comments