Knowledge points that are not well known and useful in CPP programming

Source: Internet
Author: User

I. extern syntax

extern can be placed before a variable or function to represent the definition of a variable or function in another file, prompting the compiler to find its definition in other modules when it encounters this variable or function. In addition, extern can also be used to specify links.

1. When two files have a variable name of the same name at the same time, they can be compiled separately, but when they are linked, they cannot be compiled.
Since the link indicates that this is a program, a program cannot have two variables of the same name.

You can then use extern to tell one of the files to use a variable of the same name as another file.

2, extern "C"

Knowledge points that are not well known and useful in CPP programming

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.