Skip to content

Commit 34eea0a

Browse files
Harsh Karandeayaankhan98
Harsh Karande
andauthored
review: make get getPrecedence
Co-authored-by: Ayaan Khan <[email protected]>
1 parent fc3bc8b commit 34eea0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

conversions/infix_to_postfix.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void push(struct Stack *p, char ch); // pust element in stack
2525
char pop(struct Stack *p); // pop topmost element from the stack
2626
int isOprnd(char ch); // check if element is operand or not
2727
int isEmpty(struct Stack s); // check if stack is empty
28-
int prcnd(char op1, char op2); // check operator precedence
28+
int getPrecedence (char op1, char op2); // check operator precedence
2929
void convert(char infix[],
3030
char postfix[]); // convert infix to postfix expression
3131

@@ -164,7 +164,7 @@ void convert(char infix[], char postfix[])
164164
{
165165
while (isEmpty(s) == 0) // check if stack is empty
166166
{
167-
pr = prcnd(ch,
167+
pr = getPrecedence (ch,
168168
s.arr[s.tos]); // check operator precedence
169169

170170
if (pr == 1)
@@ -193,12 +193,12 @@ void convert(char infix[], char postfix[])
193193
}
194194

195195
/**
196-
* @brief prcnd function
196+
* @brief getPrecedence function returns the precedence after comparing two operators passed as parameter.
197197
* @param op1 : first operator
198198
* @param op2 : second operator
199199
* @returns 1 or 0 on exit
200200
*/
201-
int prcnd(char op1, char op2)
201+
int getPrecedence (char op1, char op2)
202202
{
203203
if (op2 == '$')
204204
{

0 commit comments

Comments
 (0)