报错记录 类型未定义警告
2026/7/22 6:27:53 网站建设 项目流程

type of ‘n’ defaults to ‘int’ [-Wimplicit-int]

#include<stdio.h> #include<string.h> int fun(int n) { //第一层:5*fun(4) //第二层:4*fun(3) //第三层:3*fun(2) //第四层:2*fun(1) //第五层:return 1 if(n==1) { return 1; } else if(n>1) { return n*fun(n-1); } } int main(int argc, char const *argv[]) { //函数递归 int n=fun(5); printf("%d\n",n); return 0; }

原因:int fun(n)函数参数类型,没有加类型定义,应该是int fun(int n)

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询