主题:代码有错误,大家帮忙改一下~~~
嘿嘿,初学者,大家帮忙看一下啦
#include "stdio.h"
#include "stdlib.h"
#define N 27
typedef struct Qnode{
int data;
struct Qnode *next;
}Qnode,*Queueptr;
typedef struct {
Queueptr front;
Queueptr rear;
}LinkQueue;
LinkQueue *Q;
void InitQueue(LinkQueue &Q)//所有的错误都在这一行
{
Queueptr qnew,p;
int i,num;
num=1;
Q->front=p=(struct Qnode*)malloc(sizeof(struct Qnode));
if(!Q->front)exit(OVERFLOW);
Q->front->data=num;
for(i=1;i<N;i++)
{
qnew=(struct Qnode*)malloc(sizeof(struct Qnode));
if(!qnew)exit(OVERFLOW);
p->next=qnew;
p=qnew;
qnew->data=++num;
}
Q->rear=qnew;
}
void main()
{
void InitQueue(Q);
}
错误:
F:\study\text1\text1.c(16) : error C2143: syntax error : missing ')' before '&'
F:\study\text1\text1.c(16) : error C2143: syntax error : missing '{' before '&'
F:\study\text1\text1.c(16) : error C2059: syntax error : '&'
F:\study\text1\text1.c(16) : error C2059: syntax error : ')'
#include "stdio.h"
#include "stdlib.h"
#define N 27
typedef struct Qnode{
int data;
struct Qnode *next;
}Qnode,*Queueptr;
typedef struct {
Queueptr front;
Queueptr rear;
}LinkQueue;
LinkQueue *Q;
void InitQueue(LinkQueue &Q)//所有的错误都在这一行
{
Queueptr qnew,p;
int i,num;
num=1;
Q->front=p=(struct Qnode*)malloc(sizeof(struct Qnode));
if(!Q->front)exit(OVERFLOW);
Q->front->data=num;
for(i=1;i<N;i++)
{
qnew=(struct Qnode*)malloc(sizeof(struct Qnode));
if(!qnew)exit(OVERFLOW);
p->next=qnew;
p=qnew;
qnew->data=++num;
}
Q->rear=qnew;
}
void main()
{
void InitQueue(Q);
}
错误:
F:\study\text1\text1.c(16) : error C2143: syntax error : missing ')' before '&'
F:\study\text1\text1.c(16) : error C2143: syntax error : missing '{' before '&'
F:\study\text1\text1.c(16) : error C2059: syntax error : '&'
F:\study\text1\text1.c(16) : error C2059: syntax error : ')'