用C语言出现 parse error before '&' token 这种错误怎么解决?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用C语言出现 parse error before '&' token 这种错误怎么解决?相关的知识,希望对你有一定的参考价值。

源程序是这样的#include <stdio.h>#include <stdlib.h>typedef struct lnode int data; struct lnode *next;lnode,*linklist;void creat (linklist& l,int n) l=(linklist)malloc(sizeof(lnode)); l->next=NULL; linklist p; int i=n; while(i>0) p=(linklist)malloc(sizeof(lnode)); scanf("%d",&p->data); p->next=l->next; l->next=p; i--; void main(int argc, char *argv[]) int T; scanf("%d",&T); int y; for(y=1;y<=T;y++) linklist l; int m; scanf("%d",&m); linklist q; creat( l, m); int j=1; while(j<=m) q=l; printf("%d",q->next->data); l=l->next; free(q); j++; system("PAUSE"); return 0;

你好, 
void creat (linklist& l,int n) 
你是想使用引用是吧, 然后在create函数中, 修改l的值 
不过, 在C里面, 是没有C++的引用功能的, 所以你最好使用二级指针
或者直接使用C++重写
参考技术A void creat (linklist& l,int n) 是*不是&吧

以上是关于用C语言出现 parse error before '&' token 这种错误怎么解决?的主要内容,如果未能解决你的问题,请参考以下文章

VC编译C语言出现syntax error : missing ')' before ';'错误

C语言问题,error C2143: syntax error : missing ';' before 'type'啥意思?

c语言求助 帮我看看,求大神,错误是syntax error before'&' token,急

c语言生成没有错,运行出现debug error

使用vs2013编写c语言程序 为啥 会出现max函数没有被定义error

帝国备份王出现 Parse error: syntax error, unexpected end of file解决办法