Created
October 26, 2018 03:34
-
-
Save VergilSkye/39d014d351ffb8f80954d976910fc56e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char *infixToPrefix(char *infix){ | |
//Tamanho da string recebida | |
int l = strlen(infix); | |
//Inverte a string recebida | |
infix = strrev(infix); | |
//Arruma os parenteses que estão errados | |
//depois da operação de reversão | |
for (int i = 0; i < l; i++) | |
{ | |
if (infix[i] == '(') | |
{ | |
infix[i] = ')'; | |
continue; | |
} | |
else if (infix[i] == ')') | |
{ | |
infix[i] = '('; | |
continue; | |
} | |
} | |
char *prefix = infixToPostfix(infix); | |
prefix = strrev(prefix); | |
return prefix; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment