"C++ Primer" Reading Notes-Chapter Two Variables and Basic Types

Chapter 2 Variables and Basic Types

1. When writing your own header files, develop the habit of adding header file protectors

1.1
1.2

2. The declaration of constant expressions

2

3. After defining the class, remember to add a semicolon

3

4. When declaring, treat references and pointers as part of the declarator

int a,*b,&c = a;

The type of a is int The type of
b is int *
The type of c is int&

5. When declaring a pointer, it is best to initialize the pointer to nullptr

6. Local variables with the same name will overwrite global variables

7. The initialization of variables is very important

8. The difference between declaration and definition

Insert picture description here

Guess you like

Origin blog.csdn.net/youyadefeng1/article/details/112603827