gpt4 book ai didi

c - 在 Visual Studio 2010 中显示 "warning C4028: formal parameter 1 different from declaration"

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

你好,我有下面的代码

我收到的警告是“警告 C4028:形参 1 与声明不同”

我不确定我哪里错了。我认为我的参数声明是正确的,但请帮助我。

# include <stdio.h>
# include <conio.h>
# include <math.h>

main()
{
int x,y(),z,sqrt(int),cube(int);
printf("Enter any number:");
scanf("%d",&x);
z=(x>y() ? sqrt(x):cube(x));
printf("%d",z);
getche();
return 0;
}
int sqrt(int a)
{
printf("Square:");
return(a*a);
}
int cube(int b)
{
printf("Cube:");
return(b*b*b);
}
int y()
{
return(10);
}

最佳答案

int x,y(),z,sqrt(int),cube(int);

sqrt 已经是在 math.h 中声明的具有不同原型(prototype)的 C 库函数。

您必须将 sqrt 函数重命名为其他名称。

关于c - 在 Visual Studio 2010 中显示 "warning C4028: formal parameter 1 different from declaration",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20840464/

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