在“manu”不匹配重新声明中切换大小写如何解决此问题?
#include<stdio.h>
#include<conio.h>
struct node
{
int data;
struct node *nxtadd;
}*head=NULL,*temp,*temp1;
void insert_first()
{
if(head==NULL)
{
head=(struct node *)malloc(sizeof(struct node));
scanf("%d",&head->data);
head->nxtadd=NULL;
}
else
{
temp1=head;
while(temp1->nxtadd!=NULL)
{
temp=temp1->nxtadd;
}
}
}
void display()
{
if(head==NULL)
{
printf("No LINK LIST Crated , First Insert Record.");
}
else
{
temp1=head;
while(temp1!=NULL)
{
printf("%d",&head->data);
temp=temp1->nxtadd;
}
}
}
void delete_first()
{
if(head==NULL)
{
printf("No LINK-LIST Created, First insert record(s).");
}
else
{
temp=head;
head=head->nxtadd;
free(temp);
display();
}
}
void sub_manu_insert()
{
int a;
while(1)
{
printf("------------------------------------------------------------/n");
printf(" LINK LIST - Sub Manu. \n");
printf("------------------------------------------------------------/n");
printf("select Opration\n");
printf("------------------------------------------------------------/n");
printf("1). insert-first\n");
printf("2). insert-last\n");
printf("3). Exit\n");
printf("------------------------------------------------------------/n");
scanf("%d",&a);
switch(a)
{
case 1:
insert_first();
break;
case 2:
insert_last();
break;
case 3:
clrscr();
manu();
break;
default:
printf("Enter Proper Number..");
}
}
}
void sub_manu_delete()
{
int a;
while(1)
{
printf("------------------------------------------------------------/n");
printf(" LINK LIST - Sub Manu. \n");
printf("------------------------------------------------------------/n");
printf("select Opration\n");
printf("------------------------------------------------------------/n");
printf("1). Delete-first\n");
printf("2). Delete-last\n");
printf("3). Exit\n");
printf("------------------------------------------------------------/n");
scanf("%d",&a);
switch(a)
{
case 1:
delete_first();
break;
case 2:
delete_last();
break;
case 3:
clrscr();
manu();
break;
default:
printf("Enter Proper Number..");
}
}
}
void manu()
{
int a;
while(1)
{
printf("------------------------------------------------------------/n");
printf(" LINK LIST \n");
printf("------------------------------------------------------------/n");
printf("select Opration\n");
printf("------------------------------------------------------------/n");
printf("1). Insert New Record\n");
printf("2). Display Record\n");
printf("3). Delete Record\n");
printf("4). Exit\n");
printf("------------------------------------------------------------/n");
scanf("%d",&a);
switch(a)
{
case 1:
sub_manu_insert();
break;
case 2:
display();
break;
case 3:
sub_manu_delete();
break;
case 4:
sub_manu_update();
break;
case 5:
exit(0);
break;
default:
printf("Enter Proper Number...\n");
break;
}
}
}
void main()
{
clrscr();
manu();
getch();
}
最佳答案
在 C 语言中,函数应该在使用之前声明或定义。否则,将为该函数创建默认声明,如果与实际定义不匹配,您将收到错误。
因此将函数的声明放在程序的开头:
void manu();
关于c - 'manu' 不匹配重新声明中的 switch case,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34420195/