C error, “expected declaration specifier”


typedef struct _lnode{
    struct _lnode *next;
    unsigned short row;
    unsigned short column;
    short data;

typedef struct _llist{
    struct _lnode *header;
    unsigned int size;


lnode* add(lnode *lnode, lnode *newNode);

I have this code in .h file and if I am trying to compile then it complains "expected declaration specifier" at the line where I declare "add" function. I recently changed IDE to Eclipse CDT and this code worked just fine on my Linux machine..

Best Solution

lnode* add(lnode *node, lnode *newNode);

don't name your variable like your typedef

and in the prototype, you don't have to name them at all

lnode* add(lnode*, lnode *);