2017-06-13 89 views
0
#include<stdio.h> 

void remove(); 
void edit(); 

//I need not send return value from function 
int main() 
{ 
    //I need not send any parameters to function 
    remove(); 
} 

void remove() 
{ 
    int flag; 
    printf("enter flag"); 
    scanf("%d",&flag); 
    if (flag==1) 
     edit(); 
} 

错误消息:在删除和调用的参数太少的redecleration中删除,并调用参数太少的redecleration类型不匹配删除

类型不匹配删除

+0

我已经返回值主做有编辑功能体 –

+0

您不能重新定义功能的标准库。 – Olaf

回答

3

这是因为功能remove()已在您的代码包含的stdio.h中定义。因此,要修复您的代码,只需将您的remove函数重命名为不同的名称,如remove_flag()

3

函数remove已在stdio.h中定义。因此,你不能命名你自己的功能remove。你应该把它命名为其他东西,比如my_remove

此外,当你不希望任何参数传递给一个函数,把void中的参数:

#include <stdio.h> 

void my_remove(void); 
void edit(void); 

//I need not send return value from function 
int main(void) 
{ 
    //I need not send any parameters to function 
    my_remove(); 
    return 0; 
} 

void my_remove(void) 
{ 
    int flag; 
    printf("enter flag"); 
    scanf("%d", &flag); 
    if (flag == 1) 
     edit(); 
} 

void edit(void) 
{ 
    printf("edit\n"); 
}