1. What is C language
C language is a general-purpose computer programming language, which is widely used in low-level development. The design goal of the C language is to provide a programming language that can be compiled in an easy way, handle low-level memory, generate a small amount of machine code, and can run without any operating environment support. I won't introduce too much here, and interested friends can find out by themselves.
2. The first C language program
2.1 Download and start vs
2.2 Write code
Write a code to print hello world on the screen
2.3 Compile the code
compile+link+run
Shortcut key Ctrl+F5/Ctrl+Fn+F5
3. Data type
Why are there so many types?
What is the size of each type?
Note: There are so many types, in fact, to express various values in life more abundantly.
Units that exist in the C language
bit, byte - byte
1byte=8bit
KB 1KB=1024byte
MB 1MB=1024KB
GB 1GB=1024MB
TB 1TB=1024GB
PB 1PB=1024TB
4. Variable constants
Some values in life are constant (such as: gender, blood type)
Some values are variable (eg: age, weight)
Constant values are represented by the concept of constants in C language, and variable values are represented by variables.
4.1 How to define variables
Type variable name = xxx
4.2 Naming of variable names
1. Can only be composed of letters (including uppercase and lowercase), numbers and underscores (_).
2. It cannot start with a number.
3. The length cannot exceed 63 characters.
4. Variable names are case-sensitive.
5. Variable names cannot use keywords.
4.3 Classification of variables
1. Local variables and global variables
Note: When a local variable has the same name as a global variable, the local variable takes precedence
2. The use of variables
//scanf input statement
//printf output statement
4.4 The scope and life cycle of variables
1. Scope
The scope of a local variable is the local scope in which the variable resides
The scope of global variables is the entire project
2. Life cycle
The life cycle of a local variable is: the life cycle of entering the scope begins, and the life cycle of the out of scope ends.
The life cycle of global variables is: the life cycle of the entire program