C traps and defects note-extern

Source: Internet
Author: User

Create a file named a.h, which contains the declaration:

Extern int I;

Each C of the External Object filename needs to be used.Source codeYou should add the following statement:

# Include "a. h"

Finally, we select a C source file, in which the initial value of I is given. We call this file a. c.

# Include <stdio. h> # include ". H "int I = 8; int main (void) {printf (" % d \ n ", I); return 0 ;}

As long as the declarations in the source file are consistent and only one of these declarations is the definition of I, the write is legal.

So the aboveCodeCan be correctly compiled and executed.

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.