NIL_ 2017-10-15 00:02 采纳率: 0%
浏览 1018

C语言链表问题怎么改错

#include
#include

typedef struct TNode{
int data1;
int data2;
struct TNode *next;
}*List;

void CreateList(List &L,int n){
L=(List) malloc (sizeof(TNode));
L->next=null;
List p;
for(int i = 0;i<=n;i++){
p=(List) malloc (sizeof(TNode));
scanf("%d",&p->data1);
scanf("%d",&p->data2);
p->next=L->next;
L->next=p;
}//Create
void main(){
int n;
scanf("%d",&n);
}

求助请问怎么改才不出错
d:\c\mutiply\mutiply1.c(10) : error C2143: syntax error : missing ')' before '&'
d:\c\mutiply\mutiply1.c(10) : error C2143: syntax error : missing '{' before '&'
d:\c\mutiply\mutiply1.c(10) : error C2059: syntax error : '&'
d:\c\mutiply\mutiply1.c(10) : error C2059: syntax error : ')'
d:\c\mutiply\mutiply1.c(29) : fatal error C1004: unexpected end of file found
mutiply2.cpp
d:\c\mutiply\mutiply2.cpp(12) : error C2065: 'null' : undeclared identifier
d:\c\mutiply\mutiply2.cpp(12) : error C2440: '=' : cannot convert from 'int' to 'struct TNode *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\c\mutiply\mutiply2.cpp(21) : error C2601: 'main' : local function definitions are illegal
d:\c\mutiply\mutiply2.cpp(26) : fatal error C1004: unexpected end of file found

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-15 01:52
    关注

    NULL,不是null
    另外你少了花括号。
    }//Create
    这里的花括号是和for循环对应的,函数的花括号没了。

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型