Basic data type

constant ： Data is immutable during operation

variable ： Data can be changed during operation

identifier ： Such as type name , Variable name , Function name

1, integer

long           4 byte         Range ： Unsigned 0-2 Of 32 Power -1    Signed -2 Of 31 Power   -
2 Of 31 Power -1

short          2 byte

int             Usually 4 Bytes , But different platform lengths are different

signed       Signed      Represents the highest order when the symbol is used

unsigned   Unsigned       Represents the highest bit when the number is used

constant ： 234  Default to integer （ instead of char or short This needs attention ）

234L  long type （ Long integer ）

234U Unsigned int type

234UL  Unsigned long type

Base ：

Binary     In coding   Unable to express directly
supplement ：0b101010110 Not expressible in code , A lot of people don't pay attention to this

decimal system     123

octal number system     0123               0 As a distinction

hexadecimal 0x123              0x As a distinction

Base conversion ： Decimal to other base use 10 Base number divided by base , Remainder is the converted number , Quotient continued division , And then there's the remainder to go forward , Until Shang Wei 0 stop
Other decimal to decimal Multiply the base number with the preceding bit , Add with the following bits , It's going to be the last decimal , Until the end of the last bit calculation

example ：

? Which of the following numbers are long
721387821387983  0L  0xFFFFFFFFFFF
01234234252341324
0L It's long , All others default int

? Which of the following constants are written correctly
2341234  0x9fkw8sw 032913  0432
032913 Octal medium , Meet 8 Enter one , So it's impossible to include 8 Number above
0x9fkw8sw Octal medium , Meet 16 Enter one , So it's impossible to include 16 Number above

Signed and unsigned memory structures ：

All data structures are stored in computer by complement

Codebook ： Able to represent data 2 Base

Inverse code ： Original code 2 Negation of base number

Complement ： On the basis of inverse code +1

example ：  7                  0b0000 0111  positive integer   Original code is complement code

-7                  0b0000 0111  //7

0b1111 1000  // Inverse code

0b1111 1001 // Complement -7 It's also 249
Signed

summary ： The original code is a way of expression defined for the convenience of people to understand the habit of numbers , For example, the above example ： Positive number 7 The binary number of the source code of is 0b0000 0111
-7 The binary number of the original code of 0b0000 0111 , And their complement is different , Complement is the format of real data storage .

variable ：

definition ： type Variable name [= value ];

Role of type , Specify the size of memory , Specifies the type of data saved by the current variable , And variables are just aliases of this memory

initialization ： I.e. simultaneous memory allocation

2, Solid type

double    Double precision     8 byte     After decimal point 15-17 position

float       Single precision      4 byte    After decimal point 6 position

constant ：

2.3    Default is double

2.3    Single precision

2.3e+0 index 2.3*10 Of 0 Power

3, character

char    1 byte     The essence is unsigned integer     0-255

constant     ‘a’         One character         The essence is ASCII code , One byte

character ： A symbol enclosed in single quotation marks

character string ： A sequence of characters in double quotes , with \0 end （ String is constant ）

example ：“asda” Yes 5 Characters , Contains a \0

Escape character ：

Single quotation mark     ‘ \' ’     Is a character

Double quotes     ' \" '

tab key      ‘ \t ’

Backspace key    ‘ \b ’

Alarm bell        ' \a '

enter        ‘ \r ’

Wrap        ' \n '

8 Base   '\ddd'  Must be three digits d For one 8 Number of decimal places
16 Base '\xhh'  Must be 2 Individual bit   h For one 16 Number of base bits

character set ：

ASCII 0-127 number , Number representing the character image to be drawn '\0' namely 0 number
'\0' == 0==NULL

GBK   Character set in mainland China
BIG5  Taiwan \ Hong Kong , Macao , Singapore , U.S.A
uncode  utf-8    qt android Etc utf-8 character set
utf-16
utf-24
utf-32

'A' ==65 == '\x41' ='\101' == 0x41 == 0101

Arithmetic operation of characters
'A'+2;

'8'+2; //56+2
8+2;  //8+2
"8"+2  // address +2  The string itself is the 0 Character address   The input of instruction parameter is string
"asdf" The value is a Address of the memory       be careful ： String is constant , The value of the string cannot be modified through this memory address

Technology
Daily Recommendation
views 5