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