开发者

C error, "expected declaration specifier"

开发者 https://www.devze.com 2023-02-19 07:47 出处:网络
typedef struct _lnode{ struct _lnode *next; unsigned short row; unsigned short column; short data; }lnode;
typedef struct _lnode{
    struct _lnode *next;
    unsigned short row;
    unsigned short column;
    short data;
}lnode;

typedef struct _llist{
    struct _开发者_Python百科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..


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 *);


You need to change the name of the parameter lnode, it confuses the compiler:

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

精彩评论

暂无评论...
验证码 换一张
取 消