2014.12.9 C Language Review

Source: Internet
Author: User

reviewed the preprocessing and variable types today

The preprocessing is divided into three kinds: macro definition, conditional compilation, file contains three kinds of combination in the header file, you can prevent the content in the header file to be contained repeatedly.

Variable has its scope and life cycle: by scope, divided into global variables and local variables, the global variable by default is extern, can be used for all file access, local variables can only be accessed within the function. According to the different storage location, can be divided into static variables, automatic variables, register variables, static variables stored in memory, only for the current file access, automatic variables stored in the stack, when the function call is complete destruction, register variables are stored in the register, you need to use register decoration.


The extern, static keyword relates to a function variable:

The default is extern when the function is declared, and can only be accessed within the current file with static modification. Variables are also divided into definitions and declarations, and we often say int a, which uses definitions and declarations, but is only declared when using extern int A, and other things are like functions

2014.12.9 C Language Review

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.