0

I'm working on how to pass the entire char array including its values to another function. here's the code:

#define STACK_SIZE 100
void Prefix_Conversion(char Infix_Postfix_Expression[STACK_SIZE]); 

int main(){
    //some process code here
    Prefix_Conversion(Infix_Postfix_Expression[STACK_SIZE]);
}

void Prefix_Conversion(char Infix_Postfix_Expression[]){
    //some code here
}

It gives me an error of:

[Error] invalid conversion from 'char' to 'char*' [f-permissive] [Note] initilizing argument of 1 if 'void Prefix_Conversion(char*)'

Is the prototype, arguments and array right?

David C. Rankin
  • 81,885
  • 6
  • 58
  • 85
  • possible duplicate of https://stackoverflow.com/questions/17131863/passing-string-to-a-function-in-c-with-or-without-pointers – Shiv Kumar Oct 25 '17 at 04:43

1 Answers1

0

With Prefix_Conversion(Infix_Postfix_Expression[STACK_SIZE]); you're passing one character to a function that needs char *, hence the error message.

Simply pass Prefix_Conversion(Infix_Postfix_Expression);

P0W
  • 46,614
  • 9
  • 72
  • 119