2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
- #include<stdio.h> //编译预处理指令
-
- int main() //程序的入口主函数main
- { //程序(函数、功能)结束标志
-
- return 0; //程序退出前返回给调用者(操作系统)的值
- } //程序(函数、功能)结束标志
The emphasis is on change. Its value will change during the program running.
Four characteristics: variable name, variable value, storage unit, variable type; define first and then use.
It consists of letters, numbers and underscores, and can only start with an underscore or a letter, not a number. It is case sensitive.
Naming method: As the name implies, use English naming. Camel case naming, int secondPreYear. Function names are often connected by underscores.
To keep it simple, in operating systems (Windows, Linux), integers are integers (4 bytes = 32 bits), floating-point types are decimals (float: 4 bytes = 32 bits), and characters are ASCII codes (char: 1 byte = 8 bits) (which can be represented by integers)
Note: 32 bits is 2 to the power of 32
In a single-chip microcomputer, an integer is 2 bytes = 16 bits, which means that the maximum number that can be represented is 2 to the 16th power, or 65536.
The operators in C language are very rich and can be roughly divided into the following categories:
+
addition-
Subtraction*
multiplication/
division%
Find the remainder (modulus)++
Auto-increment--
Decrement==
equal!=
not equal to>
more than the<
Less than>=
greater or equal to<=
Less than or equal to&&
Logical AND||
Logical OR!
Logical NOT&
Bitwise AND|
Bitwise OR^
Bitwise XOR~
Bitwise inversion<<
Shift Left>>
Shift Right=
Assignment+=
Accumulation Assignment-=
Cumulative decrement assignment*=
Accumulated multiplication assignment/=
Cumulative division assignment%=
Remainder Assignment<<=
Left shift assignment>>=
Right shift assignment&=
Bitwise AND assignment|=
Bitwise OR assignment^=
Bitwise XOR assignment? :
Conditional operators, such asa > b ? a : b
Ifa > b
If established, the result isa
, otherwiseb
。,
The comma operator is used to execute multiple expressions in sequence, but the result of the entire expression is the result of the last expression.sizeof
Operators are used to get the number of bytes that a data type or variable occupies in memory.(type)
The type conversion operator is used to convert the value of an expression to a specified type.[]
Subscript operator is used to index into an array and to access the offset of an element pointed to by a pointer..
Member access operator for a structure or union.->
Access members of a structure or union through a pointer.&
Address-of operator.*
Pointer dereference operator (also the multiplication operator, but context determines its meaning).These operators play a very important role in C language and are the basis for building various complex expressions and statements.