塑料过滤板坑板:too many types in declaration怎么解决
来源:百度文库 编辑:杭州交通信息网 时间:2024/05/02 16:49:17
#include "stdio.h"
#include "stdlib.h"
#define ELEMTP int
struct node
{ int data;
struct node *lc,*rc;
}
struct node *root;
int m=0;
main()
{ int cord;
struct node *creat();
void preorderz(struct node *t);
void inorder(struct node *t);
void postorder(struct node *t);
do { printf("\n \n");
printf(" 1 \n");
printf(" 2 \n");
printf(" 3 \n");
printf(" 4 \n");
printf(" 5 \n");
printf("---------------------------------------------- \n");
printf("(1,2,3,4)");
scanf("%d",&cord);
switch(cord)
{ case 1:{ root=creat();
printf("\n");
printf("\n");
}break;
case 2:{ preorderz(root);
printf("\n");
printf("\n");
}break;
case 3: { inorder(root);
printf("\n");
}break;
case 4: { postorder(root);
printf("\n \n");
printf("m=%3d\n",m);
}
case 5: {printf("\n");
exit(0);
}
}
}while(cord<=5);
}
struct node *creat()
{ struct node *t,*q,*s[30];
int i,j,x;
printf("i,x=");scanf("%d%d",&i,&x);
while((i!=0)&&(x!=0))
{ q=(struct node *)malloc(sizeof(struct node ));
q->data=x;q->lc=NULL;q->rc=NULL;
s[i]=q;
if(i==1)t=q;
else {j=i/2;
if((i%2)==0) s[j]->lc=q;else s[j]->rc=q;
}
printf("i,x=");scanf("%d%d",&i,&x);
}
return(t);
}
void preorderz(struct node *p)
{ struct node *q,*s[30];
int top,bool;
q=p;top=0;
bool=1;
do{while(q!=NULL){printf("%6d",q->data);
top++;s[top]=q;q=q->rc;}
if(top==0)bool=0;
else{ q=s[top];top--;q=q->rc;}
}while(bool);
printf("\n");
}
void inorder(struct node *p)
{ if(p!=NULL) { inorder(p->lc);
printf("%6d",p->data);
inorder(p->rc);
}
}
void postorder(struct node *p)
{ if(p!=NULL) { postorder(p->lc);
postorder(p->rc);
printf("%6d",p->data);
if(p->lc==NULL&&p->rc==NULL)m++;
}
}
编译后提示第八行struct node *root有错误:too many types in declaration帮我解决一下,谢谢!!
#include "stdlib.h"
#define ELEMTP int
struct node
{ int data;
struct node *lc,*rc;
}
struct node *root;
int m=0;
main()
{ int cord;
struct node *creat();
void preorderz(struct node *t);
void inorder(struct node *t);
void postorder(struct node *t);
do { printf("\n \n");
printf(" 1 \n");
printf(" 2 \n");
printf(" 3 \n");
printf(" 4 \n");
printf(" 5 \n");
printf("---------------------------------------------- \n");
printf("(1,2,3,4)");
scanf("%d",&cord);
switch(cord)
{ case 1:{ root=creat();
printf("\n");
printf("\n");
}break;
case 2:{ preorderz(root);
printf("\n");
printf("\n");
}break;
case 3: { inorder(root);
printf("\n");
}break;
case 4: { postorder(root);
printf("\n \n");
printf("m=%3d\n",m);
}
case 5: {printf("\n");
exit(0);
}
}
}while(cord<=5);
}
struct node *creat()
{ struct node *t,*q,*s[30];
int i,j,x;
printf("i,x=");scanf("%d%d",&i,&x);
while((i!=0)&&(x!=0))
{ q=(struct node *)malloc(sizeof(struct node ));
q->data=x;q->lc=NULL;q->rc=NULL;
s[i]=q;
if(i==1)t=q;
else {j=i/2;
if((i%2)==0) s[j]->lc=q;else s[j]->rc=q;
}
printf("i,x=");scanf("%d%d",&i,&x);
}
return(t);
}
void preorderz(struct node *p)
{ struct node *q,*s[30];
int top,bool;
q=p;top=0;
bool=1;
do{while(q!=NULL){printf("%6d",q->data);
top++;s[top]=q;q=q->rc;}
if(top==0)bool=0;
else{ q=s[top];top--;q=q->rc;}
}while(bool);
printf("\n");
}
void inorder(struct node *p)
{ if(p!=NULL) { inorder(p->lc);
printf("%6d",p->data);
inorder(p->rc);
}
}
void postorder(struct node *p)
{ if(p!=NULL) { postorder(p->lc);
postorder(p->rc);
printf("%6d",p->data);
if(p->lc==NULL&&p->rc==NULL)m++;
}
}
编译后提示第八行struct node *root有错误:too many types in declaration帮我解决一下,谢谢!!
先把 struct 去掉试试
too many types in declaration怎么解决
在c语言中Too many types in declaration in function main 是什么意思呀?怎么解决呀?
have too many irons in the fire怎么造句啊?
have too many irons in the fire怎么造句啊?
have too many irons in the fire怎么造句啊?
关于计算机饿题目,急!!How many types of controls exist in ASP.NET?And what’s the difference?
寻歌Too many days
请问Have too many irons in the fire怎么造句啊?
As we know,students have too many r__ both in schooland at home.
As we know,students have too many r__ both in school and at home.