【发布时间】:2010-12-11 16:19:07
【问题描述】:
#include "MyArrayList.h"
MyArrayList::MyArrayList()
{
size = 0;
}
NODE* MyArrayList::list_create(void *data)
{
NODE *node;
if(!(node=malloc(sizeof(NODE))))
return (NODE*)NULL;
node->data=data;
node->next=NULL;
return node;
}
NODE *MyArrayList::list_add(NODE *node, void *data)
{
NODE *newnode;
newnode=list_create(data);
newnode->next = node->next;
node->next = newnode;
return newnode;
}
开启
NODE* MyArrayList::list_create(void *data)
{
NODE *MyArrayList::list_add(NODE *node, void *data)
{
myarraylist.cpp(8):错误 C2143:语法错误:缺少 ';'在'*'之前
myarraylist.cpp(8):错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持 default-int
myarraylist.cpp(8): error C2065: 'data' : undeclared identifier
myarraylist.cpp(8): 错误 C2761: 'MyArrayList::NODE *MyArrayList::list_create(void *)' : 不允许成员函数重新声明
myarraylist.cpp(8):致命错误 C1903:无法从先前的错误中恢复;停止编译
它是一个链表
【问题讨论】:
-
你从编译器得到了什么exact错误信息?
-
错误信息是什么?你的代码应该做什么?如果您希望人们帮助您修复您的代码,您应该提供足够的详细信息让他们了解您的问题。
-
NODE的定义在哪里?
标签: c++