Expected identifier or ‘(’ before ‘char’ syntax error
<p>I can't find this syntax error that reads:</p>

<blockquote>
  <p>/home/ubuntu/workspace/stack.c:6:12: error: expected identifier or ‘(’ before ‘char’<br>
   char stack(char cmd[40])<br>
              ^</p>
</blockquote>

<p>The ^ symbol being under the second c in stack(char, I've looked around and I can't find an answer, most of them are something simple like a ; at the end of the main function, but I can't see anything wrong with this. Anyone got an idea?</p>

<p>stack.c</p>

<pre><code>#ifndef stack
#define stack
#include &lt;stdio.h&gt;
#include "stack.h"

char stack(char cmd[40])
{

stacks newstack()
{
    stacks s;
    s -&gt; head = NULL;
    return s;
}

void deletestack(stacks s)
{
    node temp;
    while(s -&gt; head)
    {
        temp = s -&gt; head;
        s -&gt; head = s -&gt; head -&gt; next;
        free(temp);
    }
    free(s);
}

int isEmpty(stacks s)
{
    if(s -&gt; head == NULL)
        return 1;
    else
        return 0;
}

void push(stacks s, element e)
{
    node n = (node)malloc(sizeof(node_type));
    n -&gt; e = e;
    n -&gt; next = s -&gt; head;
    s -&gt; head = n;
}

element peek(stacks s)
{
   return s -&gt; head -&gt; e; 
}

void display(stacks s)
{
    while(s -&gt; head)
    {
        printf("%d\n", s -&gt; head -&gt; e);
    }
}

element pop(stacks s)
{
    printf("%d\n", s -&gt; head -&gt; e);
    temp = s -&gt; head;
    s -&gt; head = s -&gt; head -&gt; next;
    free(temp);        
}



}
#endif
</code></pre>

<p>stack.h</p>

<pre><code>#ifndef ____Linked_List_H____
#define ____Linked_List_H____

#include "stdheader.h"

//Structures

//element is content of a node.
typedef int element;

//node is 1 link in a linked list. 
struct _node{
  element e;
  struct _node* next;
};

typedef struct _node node_type;
typedef struct _node* node;

//linked list is a series of links tracked by the head or start of the list.                 struct _linked_list{
  node head;
};

typedef struct _linked_list stacks_type;
typedef struct _linked_list* stacks;

stacks newstack();
void deletestack(stacks);
int isEmpty(stacks);
element pop(stacks);
void push(stacks, element);
element peek(stacks);
void display(stacks);


#endif
</code></pre>