#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <unistd.h>
#include <ctype.h>
#include <pwd.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef struct IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef struct USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
}
main()
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
}
出现如下错误:
price.c: In function `price_cacl':
price.c:65: error: dereferencing pointer to incomplete type
price.c: In function `main':
price.c:79: warning: passing arg 2 of `price_cacl' from incompatible pointer type
查了下说是结构体的问题,但是找不到原因...
7 个解决方案
#1
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct FOUINFO * PFOUINFO;
改成
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO * PFOUINFO;
或者
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct _FOUINFO * PFOUINFO;
试试
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct FOUINFO * PFOUINFO;
改成
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO * PFOUINFO;
或者
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct _FOUINFO * PFOUINFO;
试试
#2
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
像这种 FOUINFO已经被定义成一种类型数据了吧,
然后直接typedef FOUINFO * PFOUINFO;就可以了。
上面的那些结构体好像都有类似的问题。
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
像这种 FOUINFO已经被定义成一种类型数据了吧,
然后直接typedef FOUINFO * PFOUINFO;就可以了。
上面的那些结构体好像都有类似的问题。
#3
谢谢,可以了
基础还是太差了!有待加强
#4
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
#5
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
#6
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
#7
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
编译没错,运行输出为
T is 80--H is 20--L is 20--F is 40.000000
prc_code is 40101019
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
编译没错,运行输出为
T is 80--H is 20--L is 20--F is 40.000000
prc_code is 40101019
#1
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct FOUINFO * PFOUINFO;
改成
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO * PFOUINFO;
或者
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct _FOUINFO * PFOUINFO;
试试
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct FOUINFO * PFOUINFO;
改成
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO * PFOUINFO;
或者
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef struct _FOUINFO * PFOUINFO;
试试
#2
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
像这种 FOUINFO已经被定义成一种类型数据了吧,
然后直接typedef FOUINFO * PFOUINFO;就可以了。
上面的那些结构体好像都有类似的问题。
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
像这种 FOUINFO已经被定义成一种类型数据了吧,
然后直接typedef FOUINFO * PFOUINFO;就可以了。
上面的那些结构体好像都有类似的问题。
#3
谢谢,可以了
基础还是太差了!有待加强
#4
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
#5
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
#6
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT, *PIRDA_ELECT;
//typedef IRDA_ELECT * PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO, * PUSRINFO;
//typedef USRINFO * PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO ,*PFOUINFO;
//typedef FOUINFO * PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
}
//////////////////////////////////////////////////////////////////////////
#7
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
编译没错,运行输出为
T is 80--H is 20--L is 20--F is 40.000000
prc_code is 40101019
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
typedef struct _IRDA_ELECT
{
char total[10];
char high[10];
char low[10];
}IRDA_ELECT;
typedef IRDA_ELECT* PIRDA_ELECT;
typedef struct _USRINFO
{
char prc_code[10];
char mr_sn[5 + 1];
}USRINFO;
typedef USRINFO* PUSRINFO;
typedef struct _FOUINFO
{
USRINFO usrinfo;
char a[2];
}FOUINFO;
typedef FOUINFO* PFOUINFO;
int price_cacl(IRDA_ELECT Irda_elect,PFOUINFO pFouinfo)
{
float flat;
flat = atof(Irda_elect.total)-atof(Irda_elect.high)-atof(Irda_elect.low);
printf("T is %s--H is %s--L is %s--F is %f\n",Irda_elect.total,Irda_elect.high,Irda_elect.low,flat);
printf("prc_code is %s\n",pFouinfo->usrinfo.prc_code);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
IRDA_ELECT Irda_elect;
FOUINFO Fouinfo;
memset(&Irda_elect,0x00,sizeof(IRDA_ELECT));
memset(&Fouinfo,0x00,sizeof(FOUINFO));
sprintf(Irda_elect.total,"%s","80");
sprintf(Irda_elect.high,"%s","20");
sprintf(Irda_elect.low,"%s","20");
sprintf(Fouinfo.usrinfo.prc_code,"%s","40101019");
price_cacl(Irda_elect,&Fouinfo);
getchar();
return 0;
}
编译没错,运行输出为
T is 80--H is 20--L is 20--F is 40.000000
prc_code is 40101019