首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

编译异常.differs in levels of indirection

2012-03-31 
编译错误....differs in levels of indirectioncash *get_last_cash(){cash *pfirst_dataif(pNULL){re

编译错误....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;
=================================================

请问那些错误是哪里的问题??

[解决办法]

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函数前边 

热点排行