title: Passing a struct pointer to a function in C
body: <p>I'm having trouble passing a struct to a function that takes a struct pointer as an argument and keep getting the error "error: invalid type argument of unary ‘*’ (have ‘StackNode’)" </p>
  
  <p>Here's the necessary portions of my code (not all of it):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  struct stackNode{
      char data;
      struct stackNode *nextPtr;
  };
  typedef struct stackNode StackNode;
  typedef StackNode *StackNodePtr;
  
  void convertToPostfix(char infix[], char postfix[]);
  int isOperator(char c);
  int precedence(char operator1, char operator2);
  void push(StackNodePtr *topPtr, char value);
  char pop(StackNodePtr *topPtr);
  char stackTop(StackNodePtr topPtr);
  int isEmpty(StackNodePtr topPtr);
  void printStack(StackNodePtr topPtr);
  
  int main(){
      convertToPostfix(NULL, NULL);
      return 0;
  }
  
  void convertToPostfix(char infix[], char postfix[]){
      StackNode stack = {'(', NULL};
      push(*stack, 'a');
      printStack(&amp;stack);
  }
  
  void push(StackNodePtr* topPtr, char value){
      topPtr-&gt;nextPtr = NULL; //just temporary, not needed
      topPtr-&gt;data = value; //just temporary, not needed
  }
  </code></pre>
  
  <p>Any help will be appreciated, Thanks</p>