Reputation: 13978
typedef struct _lnode{
struct _lnode *next;
unsigned short row;
unsigned short column;
short data;
}lnode;
typedef struct _llist{
struct _lnode *header;
unsigned int size;
}llist;
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..
Upvotes: 0
Views: 9112
Reputation: 437336
You need to change the name of the parameter lnode
, it confuses the compiler:
lnode* add(lnode *oldNode, lnode *newNode);
Upvotes: 1
Reputation: 3937
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 *);
Upvotes: 3