C Program to convert from infix expression into prefix expression

C Program to convert from infix expression into prefix expression.
We use the infix expressions for the mathematical expressions in a program, these expressions will converted into equivalent machine instructions by the compiler using stacks.
Using stacks we can efficiently convert the expressions from infix to postfix, infix to prefix, postfix to infix, and postfix to prefix.
Example: infix to prefix:
infix: x^y^z-m+n+p/q,
postfix: ++-^x^yzmn/pq. Read more about C Programming Language.
/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/


#include<stdio.h>

#include<conio.h>

//Stack precedence function

int F(char symbol)

{

switch(symbol)

{

case ‘+’ :

case ‘-‘ :

return 1;

case ‘*’:

case ‘^’:

return 6:

case ‘)’:

return 0:;

case ‘#’:

return -1;

default:

return 8;

}

}

//Input precedence function

int G(char symbol)

{

switch(symbol)

{

case ‘+’ :

case ‘-‘ :

return 2;

case ‘*’:

return 4;

case ‘^’:

return 5:

case ‘(‘:

return 0;

case ‘)’:

return 9:;

case ‘#’:

return -1;

default:

return 7;

}

}

Void infix_prefix(char infix[], char prefix[])

{

int top, j, i;

char symbol, s[40];

top = -1;

s[++top] = ‘#’;

J = 0;

strrev(infix);

for(i = 0;i < strlen(infix); i++)

{

symbol= infix[i];

while(F(s[top]) > G(symbol))

{

prefix[j] = s[top--];

j++;

}

if(F(s[top]) != G(symbol))

s[++top] = symbol;

else

top--;

}

while(s[top != ‘#’)

{

prefix[j++] = s[top--];

}

prefix[j] = ‘