编译异常.differs in levels of indirection
编译错误....differs in levels of indirection
cash *get_last_cash()
{
cash *p=first_data;
if(p==NULL)
{
return p;
}
while((p!=NULL)&&(p->next!=NULL))
{
p=p->next;
}
return p;
}
搞个课程设计。。。用这个函数取得链表中最后一个指针,但一直编译错误(下面的错误都是这个函数的)
d:\课程设计\main.c(64) : error C2040: 'get_last_cash' : 'struct _cash *()' differs in levels of indirection from 'int ()'
d:\课程设计\main.c(65) : warning C4047: 'initializing' : 'struct _cash *' differs in levels of indirection from 'int '
d:\课程设计\main.c(70) : warning C4047: '!=' : 'int ' differs in levels of indirection from 'void *'
d:\课程设计\main.c(72) : warning C4047: '=' : 'struct _cash *' differs in levels of indirection from 'int '
============
数据结构都用一个data.h放起来,上面那个函数的文件里面已经用了#include"user.h"
typedef struct _cash_data
{
int use_all;
int use_way;//1.活动娱乐消费;2.工具/书籍经费;3.临时消费;4.定期费用;
char use_who[40];
int inorout;//1为收入,0为支出
int year;
int month;
}cash_data;
typedef struct _cash
{
cash_data all_about;
struct _cash next;
}cash;
=================================================
请问那些错误是哪里的问题??
------解决方案--------------------
cash *get_last_cash()
{
cash *p=first_data;
if(p==NULL)
{
return p;
}
while((p!=NULL)&&(p->next!=NULL))
{
p=p->next;
}
return p;
}
搞个课程设计。。。用这个函数取得链表中最后一个指针,但一直编译错误(下面的错误都是这个函数的)
d:\课程设计\main.c(64) : error C2040: 'get_last_cash' : 'struct _cash *()' differs in levels of indirection from 'int ()'
d:\课程设计\main.c(65) : warning C4047: 'initializing' : 'struct _cash *' differs in levels of indirection from 'int '
d:\课程设计\main.c(70) : warning C4047: '!=' : 'int ' differs in levels of indirection from 'void *'
d:\课程设计\main.c(72) : warning C4047: '=' : 'struct _cash *' differs in levels of indirection from 'int '
============
数据结构都用一个data.h放起来,上面那个函数的文件里面已经用了#include"user.h"
typedef struct _cash_data
{
int use_all;
int use_way;//1.活动娱乐消费;2.工具/书籍经费;3.临时消费;4.定期费用;
char use_who[40];
int inorout;//1为收入,0为支出
int year;
int month;
}cash_data;
typedef struct _cash
{
cash_data all_about;
struct _cash next;
}cash;
=================================================
请问那些错误是哪里的问题??
------解决方案--------------------
- C/C++ code
cash *get_last_cash() { cash *p=first_data; if(p==NULL) { return p; } while((p!=NULL)&&(p->next!=NULL)) { p=p->next; } return p; }//这个函数应该放在load_cash函数前边