C + + 's "program Structure"

Source: Internet
Author: User

Types of variablesfirst, global variables and local variables1, the scope of global variables: file scope. 2, the scope of local variables: function scope, block scope and function prototype scope.
second, storage type1, Auto: The default local variable storage type. 2. Register: The type of register variable that is defined to be removed directly from the register in order to improve execution efficiency. 3. Extern: Global variables common to the left and right modules. 4, Static: The type of global static variable that can be used the next time it is called.

program file structure and compile pre-processing commandsOne, the file contains #include命令与宏定义1. Common denominator: Both are preprocessing commands, so-called preprocessing commands are commands that are executed by the preprocessor before compilation. 2, different points:format:The file contains the # include command: #include < included file name > (use angle brackets for system-supplied header files)or #include "included file name" (use double quotation marks for your own defined header file and source program)macro definition: #define Identifier word string

Meaning:
The file contains the # include command: Contains the entire contents of another file.
Macro definition: Replaces the content text of macro with the same identifier as the macro name in the source program, and does nothing about the content text of the macro, but in general it is just a substitution action.


name SpaceFirst, define the format:namespace name {member;}

second, the role:Place the same name in a different space, and each group is a namespace, avoiding unnecessary name collisions.

C + + 's "program Structure"

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.