The differences between variable declaration and variable definition in c ++. December 6, 2016, variable. 2016

Source: Internet
Author: User

The differences between variable declaration and variable definition in c ++. December 6, 2016, variable. 2016

Entire Process:
1. The program tells the cpu that the program will use a variable. (This is not required for the time being. Let's talk about it first .)
2. The program tells the CPU that the program will use a variable now. (Use now)
3. The cpu divides the memory into several units (bytes) based on the type of this variable. This space is used to store the variables required by the program.
4. The CPU fills the specific data represented by this variable into the corresponding memory space according to the Data Type of this variable.
------------
Variable Declaration

Now we know two types: int a; extern;

Int;
Must include 1.; may include 2.3.4. [4. The CPU may use a NULL value to replace the specific data value, and fill in the real data value later .];
Extern;
It must contain only 1; it must not contain 2.3.4 .;

Variable definition

Must include 1.2.3.4 .;

Record Date: December 6, 2016 11:25:10

 

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.