Crazy C + + 's essential c++01

Source: Internet
Author: User

1. How to write a C + + program

A. Each program can have only one main () function, and C + + programs are executed from the main () function.
The b.class mechanism gives us an added level of abstraction within the program.
C. The specific object cin is to eat spaces and line-wrapping.
D. Differences in declarations and definitions:
A declaration makes a name known to the program, and a file must contain a declaration of that name if it wants to use a name defined elsewhere.
Defines the entity responsible for creating the name Association, and also applies for space, which may assign an initial value to the variable.

extern int I//declaration rather than definition
int I//definition rather than declaration
extern int i = 12//definition rather than declaration

650) this.width=650; "style=" Float:none; "title=" tt unnamed. jpg "src=" http://s3.51cto.com/wyfs02/M02/6C/5D/ Wkiol1vikruqbepkaabjptaik1a850.jpg "alt=" Wkiol1vikruqbepkaabjptaik1a850.jpg "/>

650) this.width=650; "style=" Float:none; "title=" 1.jpg "src=" http://s3.51cto.com/wyfs02/M02/6C/61/wKiom1VIJ6yB_ 4znaagfjicuv7m549.jpg "alt=" Wkiom1vij6yb_4znaagfjicuv7m549.jpg "/>

In different files, if you want to share the same data object, do not declare an error, but can not be defined, can only be declared, only the extern representation is a declaration.

Inside the function, an error is raised if an attempt is made to initialize a variable that is marked by the extern keyword. Because extern means that the declaration is not allocating memory space and cannot be assigned, it must be defined first.

This article from "Very blog" blog, reproduced please contact the author!

Crazy C + + 's essential c++01

Related Article

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.