gpt4 book ai didi

c - 删除的重新声明中的类型不匹配以及删除调用中的参数太少

转载 作者:太空宇宙 更新时间:2023-11-04 05:34:28 24 4
gpt4 key购买 nike

#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();
}

错误信息:

Type mismatch in redecleration of remove and too few parameters in call to remove

最佳答案

函数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");
}

关于c - 删除的重新声明中的类型不匹配以及删除调用中的参数太少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44527334/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com