"Program structure" and program structure of C ++

Source: Internet
Author: User

"Program structure" and program structure of C ++
Variable typeI. global variables and local variables1. Scope of global variables: File Scope. 2. Scope of local variables: function scope, block scope, and function prototype scope.
Ii. Storage Type1. auto: the default storage type of local variables. 2. register: register variable types defined to improve execution efficiency. 3. extern: global variables shared by left and right modules. 4. static: The Global static variable type that can be used for the next call.

Program file structure and compilation preprocessing commandsI. File Inclusion # include command and macro definition1. Commonalities: both are pre-processing commands. The so-called pre-processing commands are the commands executed by the pre-processor before compilation. 2. Differences: Format: File Inclusion # include command: # include <included File Name> (use angle brackets for system-provided header files) or # include "included file name" (use double quotation marks for custom header files and source programs) macro definition: # define mark word string

Meaning:
File Inclusion # include command: to include all the content of another file.
Macro definition: Replace the identifiers with the same macro names in the source program with the macro content text, and do not perform any operations on the macro content text. In general, it only plays a role of replacement.


NamespaceI. Definition Format:Namespace name {member ;}

Ii. role:Place the same name in Different spaces, and each group is a namespace to avoid unnecessary name conflicts.

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.