string - Invalid user conversion from char error (converting postfix using stack) -


i'm working on project convert postfix infix using stack implemented through linked list. i'm trying take in line , pushing each character onto stack keep getting error.

error: invalid user-defined conversion ‘char’ ‘const stack_element& {aka const std::basic_string&}’

here code:

#include "stack.h" string convert(string expression) {     stack c;     string post = " ";     (int =0; i<expression.length(); i++)     {         c.push(expression[i]);     } } int main() {     string expression;     cout<<" enter post fix expression: ";     getline(cin,expression);     return 0; } 

and here push function written in .cpp file

void stack::push(const stack_element & item) {     cout<<"inside push \n";     stack_node *p = new stack_node;     p->data = item;     p->next = s_top;     s_top = p; } 

do not use const parameter in push function

void stack::push(stack_element & item) 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -