Home> Common Problem> body text

What does function declaration mean?

藏色散人
Release: 2020-05-26 09:26:06
Original
6712 people have browsed it

What does function declaration mean?

What does the declaration of a function mean?

"Function definition" refers to the establishment of function functions, including specifying function name, function value type, formal parameter type, function body, etc. It is a complete and independent function unit. The function of "function declaration" is to notify the compilation system of the function name, function type, formal parameter type, number and order, so that the system can check according to this when calling the function (for example, whether the function name is correct, the actual participation Whether the type and number of formal parameters are consistent).

In terms of writing form, the function declaration can copy the function header and add a semicolon at the end; and in the parameter list, you can only write the type name of each parameter instead of the parameter name.

Definition of function

The definition of function is a complete function unit:

Includes function type, function name, formal parameters and formal parameter types , function body, etc.

In the program, a function can only be defined once

There is no semicolon between the function header and the curly braces

Declaration of the function

The function declaration is just a description of the compilation system:

The function declaration is a type description of the return value of the defined function to inform the system that the function called in this function is what type.

Does not include the function body (or formal parameters)

After calling the function several times, a corresponding statement should be made in each calling function

The function declaration is a description statement. Must end with semicolon!

The above is the detailed content of What does function declaration mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!