为什么写链表出现assignment from incompatible pointer type

楚江课的救赎 2014-09-07 02:27:15
用c写了个链表 gcc编译直接报warming: assignment from incompatible pointer type
帮忙看下原因。


typedef unsigned long DWORD; //4Bytes
typedef unsigned short WORD; //2Bytes
typedef unsigned int UINT; //通常4Bytes
typedef signed char CHAR; // 1Bytes
typedef unsigned char BYTE; //1Bytes

typedef struct TS_Node{
BYTE acDate[250];
UINT uTS_Length;
struct TS_Node*next;
}TS_Node_S;

/*
用于存储pid相同的TS包,bContain标志位用于判断当前链表中是否存储过带有效净荷的TS
*/
typedef struct TS_Store{
UINT uPid;
UINT uContain;
struct TS_Node_S*psHead;
struct TS_Node_S*psTail;
}TS_Store_S;

/*
将TS_Store_S链接起来
*/
typedef struct TS_Store_All{
TS_Store_S sTS_Store;
struct TS_Store_All *psNext;
}TS_Store_All_S;
/////////////////////////////////////////////////////////////////////////////////
if (0 == (temp->sTS_Store). uContain) {
TS_Node_S *psTS_Node = (TS_Node_S*)malloc(sizeof(TS_Node_S));
memcpy(psTS_Node->acDate,pTS_Buffer,uTS_Buffer_Length);
psTS_Node->uTS_Length = uTS_Buffer_Length;
if(NULL == (temp->sTS_Store).psHead)
{
(temp->sTS_Store).psHead = psTS_Node; //warning: assignment from incompatible pointer type
(temp->sTS_Store).psTail = psTS_Node; //warning: assignment from incompatible pointer type
(temp->sTS_Store).uContain = 1;
return 0;
}
else
{
TS_Node_S *psTS_Node_Insert = (temp->sTS_Store).psTail;
psTS_Node_Insert->next=psTS_Node;
(temp->sTS_Store).psTail = psTS_Node_Insert->next;
(temp->sTS_Store).uContain = 1;
return 0;


}
}

...全文
439 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
楚江课的救赎 2014-09-07
  • 打赏
  • 举报
回复

69,381

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧