私はCでintに対して正常に機能するコードを記述しましたが、floatを使用してこれを実行しようとすると、エラーが表示され、正しくするために何ができるでしょうか。
#include<stdio.h>
int main()
{
float a,y;
float square();
scanf("%f", &a);
y = square( a );
printf("%f %f ",a ,y);
}
float square(float b)
{
float z;
z = b*b;
printf("%f %f",z ,b);
return(z);
}
エラー:
return.c:12: error: conflicting types for 'square'
return.c:13: note: an argument type that has a default promotion can't match an empty parameter name list declaration
return.c:6: note: previous declaration of 'square' was here