Explain the difference between a procedure call and a procedure declaration,and give an example.

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 01:47:31
Explain the difference between a procedure call and a procedure declaration,and give an example.

Explain the difference between a procedure call and a procedure declaration,and give an example.
Explain the difference between a procedure call and a procedure declaration,and give an example.

Explain the difference between a procedure call and a procedure declaration,and give an example.
When you declare a procedure, you are defining things about it, like its name, its return type, its arguments, and its arguments' return types. But you are not asking the procedure to do anything. This is required so that the compiler or interpreter knows how to validate procedure calls, which is done later on. This would appear before any procedure calls are made.
When you make a prodecure call, you are asking the procedure to do something. This must be done after declaring the procedure, so that the compiler or interpreter knows how to validate the arguments.
You declare procedures exactly once. You call procedures from zero to as many times as you want.

解释程序之间的调用和申报程序的差异,举一个例子。