猫史档案馆


关于函数返回和递归

用户:不喝可的乐不喝可的乐查看:6 回复:6 评论:6 创建时间:2022-05-14T09:50:02


有没有大佬知道函数里面的返回有什么用?还有递归怎么搞?谢谢


回复

上一页1 页 / 共 1下一页
WitheredWonderWitheredWonder

返回值就是函数本身的值

点赞0


评论


WitheredWonderWitheredWonder

递归就是自己调用自己

点赞0


评论


WitheredWonderWitheredWonder

比如一个阶乘的程序就这么做

点赞0


评论


WitheredWonderWitheredWonder

center_image

点赞0


评论


D9273D9273

center_image

点赞0


评论


橙子nUcg橙子nUcg

1.返回(return)就是让该函数执行完前面的积木后,返回到调用的那块积木一个值(可以这么理解:返回就是一个参数类型的函数)。

2.递归算法,很简单,就是函数自己调用自己。当然,要防止调用栈溢出(就是不能递归太多次,可以看看下面其他人的回答)。

点赞0


评论