c++ reading notes

Some personal reading notes

variable

insert image description here
Initial value: When the object gets a specific value when it is created Default
initialization: The default initialization value of variables defined outside any function body is 0, and built-in type variables defined outside the function body will not be initialized
Declaration: Make the name Known to the program, the declaration specifies the type and name of the variable
Definition: responsible for creating the entity associated with the name

Basic built-in types

insert image description here
Signed signed: positive number, negative number, 0 (int, short, long, long long)
unsigned unsigned: means a number greater than or equal to 0

2.3 Composite types

insert image description here
Reference: A reference is not an object, but another name for an existing object. A reference can only be bound to an object, and cannot be bound to a literal value or the result of an expression

Pointer: The pointer itself is an object that allows copying and assignment, and it can point to several different objects successively during the lifetime of the pointer.

Define the pointer: basic data type * pointer name

2.5 Types of processing

insert image description here

literal constant

insert image description here
Each literal constant corresponds to a data type: the form and value of a literal constant determine its data type

Pointer literal: nullptr

Floating-point literals: represented as a decimal or scientific notation

String literal: actually an array of constant characters
The compiler adds a null character '\0' at the end of the string, so the actual length of the string literal is 1 more than its content

Decimal: By default, decimal integers are signed numbers
Octal:
Integers starting with 0 Hexadecimal: Integers starting with 0x or 0X

Guess you like

Origin blog.csdn.net/weixin_44848852/article/details/125433548