Static functions of C language

Source: Internet
Author: User

When a source program consists of multiple source files, the function is divided into internal functions and external functions, depending on whether the function can be called by functions in other source files.
1 intrinsic functions (also called static functions)
If a function defined in a source file can only be called by a function in this file, but not by a function in the other file of the same program, this function is called an intrinsic function.
Define an intrinsic function by simply adding a "static" keyword before the function type:
static function type function name (function parameter table)
The keyword "static", translated into Chinese, is "still", so the internal function is also called the static function. But the meaning of "static" here does not mean storage, but the scope of the function is limited to this file.
The advantage of using intrinsic functions is that when different people write different functions, they don't have to worry about the functions they define, or whether they have the same name as the functions in other files, because the same name doesn't matter.

2 external functions
Definition of an external function: when defining a function, if the keyword "static" is not added, or the keyword "extern", it means that the function is an external function, which is our most commonly used form of function.

Static functions of C language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.