Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 如何修复此错误?警告:函数的隐式声明‘;主菜单&x2019;_C_Linked List - Fatal编程技术网

C 如何修复此错误?警告:函数的隐式声明‘;主菜单&x2019;

C 如何修复此错误?警告:函数的隐式声明‘;主菜单&x2019;,c,linked-list,C,Linked List,这是一个利用LinkedList的b日提醒代码 typedef struct node { char name[61]; int month; int day; int year; struct node *next; }node; 这是名单 typedef struct list { node *head; node *tail; }list; 这是创建列表代码 list *c

这是一个利用LinkedList的b日提醒代码

typedef struct node  
{  
    char name[61];  
    int month;          int day;  
    int year;  
    struct node *next;  
}node;  
这是名单

typedef struct list  
{  
    node *head;  
    node *tail;  
}list;  
这是创建列表代码

list *create_list(list *plist)  
{  
    plist->head = NULL;  
    plist->tail = NULL;  
    return plist;  
}  
这会将创建的节点插入到列表中

list *insert_list(list *plist, node *pnode, node *new_node)  
{  
    new_node->next = pnode->next;  
    pnode->next = new_node;  
    if (plist->tail == pnode)  
    {  
            plist->tail = new_node;  
    }  
}  
这是添加生日菜单

void add_birthday(list *List)  
{  
    char x;  
    node *data = (node *) malloc(sizeof(node));  
    List = (list*) malloc(sizeof(list));  
    printf("******************************************************************\n");  
    printf("                    ADD BIRTHDAY REMINDER FORM\n");  
    printf("******************************************************************\n");  
    List = insert_list(List, data, create_node(data));  
    printf("Would you like to add another(y/n)?\n");  
    scanf("%c", &x);  
    if (x=='y')  
    {  
            while (x=='y')  
            {  
                    if (x=='y')  
                    {  
                            getchar();  
                            printf("******************************************************************\n");  
                            node *data = (node *) malloc(sizeof(node));  
                            List = insert_list(List, data, create_node(data));  
                            printf("Would you like to add another(y/n)?\n");  
                            scanf("%c", &x);  
                    }  
            }  
    }
    main_menu(List);  //the problem lies here
}  
这是主菜单

void main_menu(list* List)  
{  
    int x;  
    printf("Welcome to myCalendar version 1.0.0\n");  
    printf("Please input the number that you wish to do:\n");  
    printf("[1] Add Birthday Reminder\n");  
    printf("[2] Delete Birthday Reminder\n");  
    printf("[3] View Calendar\n");  
    printf("[4] Quit\n");  
    scanf("%d", &x);  
    getchar();  
    switch (x)  
    {  
            case 1:  
                    add_birthday(List);  
                    break;  
            case 2:  
                    delete_reminder(List);  
                    break;  
            case 3:  
                    view_calendar(List);  
                    break;  
            case 4:  
                    free(List);  
                    break;  
        }  
}
这是主要原因

int main(void)  
{  
    list* List = (list*) malloc(sizeof(list));  
    List = create_list(List);  
    main_menu(List);  
    return 0;  
}  

您没有将包含*.h的main_menu()声明包含在包含*.c的main()或add_birth()中,或者在任何指向错误的地方都没有包含。

您是否声明了main_menu?在没有声明的情况下,假定函数返回“int”。但是,你们的函数定义说,它正在返回void。这就是所有混乱的原因。

主菜单()的定义。
添加生日()之后。
?如果是,请在
添加生日()之前定义
主菜单()
。还要在
main()之前定义所有方法,或者至少在
main()之前声明它们

这些是警告测试。c:290:警告:函数“主菜单”测试的隐式声明。c:在顶层:测试。c:357:警告:“主菜单”测试的冲突类型。c:290:注意:“主菜单”之前的隐式声明在此