int INFIX_TO_POSTFIX(string infix, char* postfix_return)      //Conversion function
{
    STACK<char> STACK;
	int i = 0, z = 0;
	char postfix_array[25];
	string postfix;
	cout << "Postfix Equation: ";
	for (int pos = 0; pos < infix.size() ; pos++)  //For the length of the infix string until end of string:
    {

		if (infix[pos] == '+' || infix[pos] == '-' || infix[pos] == '/' || infix[pos] == '*' || infix[pos] == '^')        //If is operator:
		{
			//Checks if stack is empty, if top of stack is parentheses, and the priority of each operator on the stack
			while(!STACK.isEmpty() && operatorPriority(STACK.Return_Top_of_Stack()) <= operatorPriority(infix[pos]) && STACK.Return_Top_of_Stack() != '(' && STACK.Return_Top_of_Stack() != ')')
			{
				postfix_array[i] = STACK.Return_Top_of_Stack();
				i++;
				cout << STACK.POP();  //POPs stack                                                                                            
			}                                                                                                                                
            STACK.PUSH(infix[pos]);   //PUSHes operator to stack
        }
		else if (infix[pos] == '('){  //If char is '('
             STACK.PUSH(infix[pos]);  //PUSHes to operator stack
        }
		else if (infix[pos] == ')'){  //If char is ')'
			while (STACK.Return_Top_of_Stack() != '(') {        //Return top of stack until '('
				postfix_array[i] = STACK.Return_Top_of_Stack(); //Stores top of stack into postfix string
				i++;
				cout << STACK.POP();                            //Print POP'd operator
            }
			STACK.POP();                                        //POPs the '('
        }
		else {
            postfix_array[i] = infix[pos];   
            i++;
            cout << infix[pos];
        }
    }
	while (!STACK.isEmpty()) {								   //Dumps the stack
		postfix_array[i] = STACK.Return_Top_of_Stack();		   //Stores contents of stack into postfix array
		i++;
		cout << STACK.POP();
    }
    for (z = 0; z < i; z++)
    {
        postfix_return[z] = postfix_array[z];				   //Stores postfix array into Main
    }
    cout << endl;
    int length = i;											   //Length of postfix array
    return length;
}