问题描述
- 指针空间分配问题?debug出错了
-
typedef string ElemType;typedef struct LNode {
ElemType data;
struct LNode next;
}LNode,*LinkList;
Status ListInit(LinkList &l) {
l = (LinkList)malloc(sizeof(LNode));
l->next = NULL;
l->data = "";
return OK;
}
void main(){
LinkList l;
ListInit(l);
}
编译没错
debug时
Unhandled exception at 0x01232df6 in TEST.exe: 0xC0000005: Access violation writing location 0xcdcdc
但换成typedef int ElemType;就没报错了***
时间: 2024-10-02 14:17:56