//++++++++++++源代码main.c++++++
#include<stdio.h>
int main(){
float a = 1.5;
show(a);
return 0;
}
//++++++++++++源代码show.c++++++
#include <stdio.h>
void show(float a){
printf("%f\n",a);
}
编译:gcc -o test main.c show.c
运行后,输出 0.000000 =============> 错误输出
1)、修改:在main.c中加入对show的声明
void show(float); //添加一条声明
int main()
{
......}
编译后输出:1.500000 =============> 正确输出
2)、修改:将float换成 int或者char或者double; printf中用相应的输出格式%d,%c
但是不添加show()函数的声明,编译正常输出 =============> 正确输出
奇怪吧? int 、char、double类型不用加声明都可以正常输出,而float不行
这是为什么呢?????