C 语言中的隐式返回类型 int
如果某个函数没有返回类型,那么返回类型将隐式地为 int。如果不存在返回类型,那么它不会引发任何错误。但是,C99 版本不允许省略返回类型,即使它是 int。
示例
#include<stdio.h>
my_function(int x) {
return x * 2;
}
main(void) {
printf("Value is: %d", my_function(10));
}输出
Value is: 20
广告
如果某个函数没有返回类型,那么返回类型将隐式地为 int。如果不存在返回类型,那么它不会引发任何错误。但是,C99 版本不允许省略返回类型,即使它是 int。
#include<stdio.h>
my_function(int x) {
return x * 2;
}
main(void) {
printf("Value is: %d", my_function(10));
}Value is: 20