关于C中的功能的问题..... [英] question about functions in C.....

查看:49
本文介绍了关于C中的功能的问题.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在书中读到用户定义的功能包括两部分

功能声明

功能定义





但我认为用户定义的功能包括三个部分

功能声明

功能定义

函数调用





我是写还是错?

解决方案
否。函数调用不是函数的一部分。但是,这是为函数创建的。



请记住,函数是抽象,它允许开发人员在软件的多个位置使用相同的算法产品,带参数化。每次调用都是控件跳转到函数代码的特殊类型,控件返回到函数代码退出时调用的方式。这是通过使用堆栈来完成的,它还用于在调用代码中将函数参数放在其上。一般来说,通过其他一些功能进行通话。





当然,功能正文可以包含对自己的呼唤;这称为递归: http://en.wikipedia.org/wiki/Recursion_%28computer_science%29 [ ^ ]。
-SA

I read in my book that user defined function consist of two parts
function declaration
function definition


but I think that user-defined function consist of three parts
function declaration
function definition
function call


is I right write or wrong?

解决方案

No. Function call is not a part of the function. However, this is what a function is created for.

Remember that function is the abstraction which allows the developer to use the same algorithm in more then one place of the software product, with parametrization. Each call is the special kind of jump of the control to the code of the function, the way the control returns to the point of the call on exit from the function code. This is done with the use of the stack, which is also used to put function parameters on it in the calling code. Generally speaking, the call is performed from some other function.


Of course, the body of the function can contain the call to itself; this is called recursion: http://en.wikipedia.org/wiki/Recursion_%28computer_science%29[^].
—SA


这篇关于关于C中的功能的问题.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆