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[])
215
215
s [++ i ] = c = next ;
216
216
}
217
217
}
218
- else
219
- {
220
- c = getch ();
221
- }
222
218
223
219
if (isdigit (c ))
224
220
{
Original file line number Diff line number Diff line change @@ -304,3 +304,7 @@ int getop(char s[])
304
304
305
305
return NUMBER ;
306
306
}
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[])
27
27
28
28
str [j ++ ] = c ;
29
29
}
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
+ }
30
37
}
31
38
32
39
// NOTE: As a simple observation when recursive functions are used, static
You can’t perform that action at this time.
0 commit comments