C + + Primer 2nd Chapter

Source: Internet
Author: User

I learned today.

30 page ~49 page.

1. The choice of arithmetic type, generally only use int,double. exceeding int is a long long instead of a long. Floating-point type with double instead of float, the cost difference between the two is small.

2. Convert I to an unsigned number before adding. If int occupies 32 bits. Then I mod 2 of 32, that is, -42 mod 4294967296 = 4294967254. Then add with u, 4294967256 + 10 = 4294967264. Output 4294967264.

Ten ; int i =-<< U + i << Endl;

3. The literal value of value 20 20/* decimal */024/* octal */0x14/* hex */.

4. Declarations and definitions. If you want to use the same variable in multiple files, you must separate the declaration and definition. The definition of a variable must appear and appear in only one file, while other files that use the variable must be declared, but cannot be repeatedly defined.

Double 3.1416;   // definition extern double pi;     // Statement

5. Most scopes in C + + are delimited by curly braces.

6. The reference is an alias.

7. Pointers

int ;        // defines a variable ival of type int, with a value of int* p = &val;        // defines a pointer to the int* type P, which holds the address of the INT type variable. Use the Fetch address (operator &) to get the address of the ival variable and assign it to Pint* pp = p;          // define a variable of type int* PP, assign the address stored in P to ppcout << *p << Endl;   // Use the dereference (operator *) to access an object of that address

We're going to learn tomorrow.

49 Page ~118 page.

The 2nd Chapter variables and basic types.

The 3rd chapter is the string, vector and array.

C + + Primer 2nd Chapter

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.