static statics function

Source: Internet
Author: User

Static acting on function: e.g.: static void Func (void);
When using static for function definitions, it has an effect on how the function is connected, so that the function is valid only within this file and is not visible to other files. Such a function is also called a static function. The advantage of using static functions is that you do not have to worry about interfering with the functions of the same name as other files, but also a protection mechanism for the function itself.

e.g.:

If you do not add static in the func1.c its link way can be inside, func2.c can make a call, even if the invocation of the declaration is not added extern;

When you add it, you'll report undefined print.

static statics function

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.