NOTES: "C + + Primer" chapters 1th and 2nd

Source: Internet
Author: User

1, standard provisions, include C + + provided standard header file or system header file should use angle brackets, including the custom header file can use double quotation marks.

Correct wording:

#include <iostream>

#include "Myclass.h"

Error wording:

#include <iostream.h>

2. When Endl writes to the output stream, it has the effect of outputting line wrapping and refreshes the buffer associated with the device.

3, "." The difference from "->>" is that the left side of the former is a class object, and the left side of the latter is a class object pointer or struct object pointer.

4. Char (character type) is used to store the corresponding numeric value of any character in the machine's basic character set; wchar_t (wide character type) is used to store extended character sets such as Kanji and Japanese.

5, each bit storage 0 or 1, usually 8 bits of the block as a byte, 32-bit or 4 bytes as one word (word).

6. For bool type, the 0 value represents false, and a non-0 value represents true.

7, at the end of a line with a backslash symbol "\" You can treat this line and the next line as the same line, followed by a comment or a space is not allowed.

8. Variable names consist of letters, numbers, and underscores. Variable names must begin with a letter or underscore, and are case-sensitive.

9. Direct initialization is more flexible and more efficient than replication initialization.

int value (1024); Direct initialization

int value=1024; Replication initialization

10. In the case of built-in type variables, variables defined outside the function body are initialized to 0, and variables defined in the function body are not initialized automatically. It is recommended that objects of each built-in type be initialized.

11. The non-const variable defaults to extern and can be accessed in other files. The const variable cannot be accessed by other files by default and must be explicitly specified as extern if it is to be accessed by another file.

12, the Reference "&" is the alias of the variable, the definition must be initialized, and cannot modify the original value.

13, "typedef" is the alias of the type, in order to hide the name of a particular type.

14. The enum "enum" member itself is a constant expression and cannot change the value of an enumeration member.

15. The only difference between defining classes with class and struct keywords is the default access level. By default, a struct member is a private Public,class member.

NOTES: "C + + Primer" chapters 1th and 2nd

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.