|
请问ICCAVR支持链表吗?程序一直报错
#include <macros.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
//双链表结点接构
typedef struct DNodeType
{
unsigned char tagaddr;
struct DNodeType *next;
struct DNodeType *prev;
}DNode;
//创建双链表
struct DNode * DoubleList(struct DNode *head)
{
int i=0;
if(NULL == head)//分配头节点空间
head=(struct DNode*)malloc(sizeof(DNode)) ;
head->prev=NULL ;
head->next=NULL;
struct DNode *current=head ;
struct DNode *temp;
DfReadOpen( 8000 );//读flash中链表区,即读取标签存放首地址,固定的
DfRead( addr, 3 );
while(1)
{
temp=(struct DNode *) malloc ( sizeof(DNode) );
//temp->tagaddr= FouByts2U32(addr,addr[i+1],addr[i+2],addr[i+3]);
temp->tagaddr=text;
i++;
temp->next=NULL;
current->next=temp; /*当前节点的后驱指向新节点*/
temp->prev=current; /*新节点的前驱指向当前节点*/
current=temp; /*当前节点为链表尾节点*/
if(temp->tagaddr == NULL) /*结束输入*/
break;
}
return head;
}
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(23): undeclared identifier `tmp'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(47): unknown field `prev' of `incomplete struct DNode defined at D:\LABDAT~1\AVR1280\program\flash1\main.c(42)'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(48): unknown field `next' of `incomplete struct DNode defined at D:\LABDAT~1\AVR1280\program\flash1\main.c(42)'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): illegal statement termination
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): skipping `struct'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): illegal use of type name `DNode'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): undeclared identifier `current'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): operands of * have illegal types `struct DNodeType' and `int'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): operands of = have illegal types `int' and `pointer to incomplete struct DNode defined at D:\LABDAT~1\AVR1280\program\flash1\main.c(42)'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(49): lvalue required
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(50): illegal statement termination
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(50): skipping `struct'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(50): illegal use of type name `DNode'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(50): undeclared identifier `temp'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(50): operands of * have illegal types `struct DNodeType' and `int'
!W D:\LABDAT~1\AVR1280\program\flash1\main.c(50):[warning] expression with no effect elided
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(55): operands of = have illegal types `int' and `pointer to incomplete struct DNode defined at D:\LABDAT~1\AVR1280\program\flash1\main.c(42)'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(57): left operand of -> has incompatible type `int'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(59): left operand of -> has incompatible type `int'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(60): left operand of -> has incompatible type `int'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(61): left operand of -> has incompatible type `int'
!E D:\LABDAT~1\AVR1280\program\flash1\main.c(63): too many errors
错误都在链表建立这里,是不是头文件不对啊?请各路大侠指点!! |
阿莫论坛20周年了!感谢大家的支持与爱护!!
如果想吃一顿饺子,就得从冰箱里取出肉,剁馅儿,倒面粉、揉面、醒面,擀成皮儿,下锅……
一整个繁琐流程,就是为了出锅时那一嘴滚烫流油的热饺子。
如果这个过程,禁不住饿,零食下肚了,饺子出锅时也就不香了……《非诚勿扰3》
|