当前位置:网站首页>What you want most is the most comprehensive summary of C language knowledge. Don't hurry to learn
What you want most is the most comprehensive summary of C language knowledge. Don't hurry to learn
2022-07-27 14:32:00 【South wind fahaxiki】
It has to be clear on the whole :
1) There are three kinds of program structure : Sequential structure 、 Selection structure ( Branching structure )、 Loop structure .
2) Read the program from main() entrance , Then read down from the top ( Run into a cycle and make a cycle , Meet the choice to make a choice ), Yes and only — individual main function .
3) The data of the computer is stored in the form of binary . Where the data is stored is His address .
4)bit Yes Refers to as 0 perhaps 1. byte It means byte , A byte = Eight .
Concepts are often tested :
1、 Compile preprocessing is not C Part of the language , No running time , Don't semicolon .C A program compiled in a language is called a source program , It uses ASCII Values are stored in text files .
2、#define PI 3.1415926; This writing is wrong , There must be no semicolons .
define a 1+2 define a (1+2)
a=a*a=1+2*1+2=5a=a*a=3*3=9
3、 Every C Language program main There is only one function .
4、 You can no longer define a function in a function .
5、 Algorithm : No input , But there must be output .
6、break It can be used for cyclic structure and switch sentence .
7、 The comma operator has the lowest level , The assigned level is the next to last .

Chapter one C Basic knowledge of language
Section 1 、 Yes C Basic knowledge of language
1、C A program written in a language is called a source program , Also called compilation unit .
2、C The form of writing is free , You can write more than one statement per line , Can write many lines .
3、 One C There is and only one language program main function , Is the starting point of program operation .
In the second quarter 、 be familiar with vc++
1、VC It's software , Used to run write C Language program .
2、 Every C When the language program is finished , They all compile first , Post link , Last run .(.c---à.obj---à.exe) Pay attention to this process .c and .obj File cannot be run , Only .exe File to run .( Regular examination !)
In the third quarter 、 identifier
1、 identifier ( What must be tested ):
Legal requirements are made by the letters , Numbers , Underline composition . There are other elements that are wrong .
And the first one must be a letter or an underline . The first number is wrong
2、 Identifiers are divided into keywords 、 Predefined identifiers 、 User identifier .
keyword : It can not be used as a user identification symbol .main define scanf printf None of them are keywords . A place to confuse you lf It can be used as a user identifier . because lf The first letter in is capitalized , So it's not keywords .
Predefined identifiers : recite define scanf printf include. Remember that predefined identifiers can be used as user identifiers .
User identifier : Basically every year , Please refer to the exercises in the book for details .
The fourth quarter, : Base conversion
Convert decimal to binary 、 octal 、 Hexadecimal .
Binary system 、 octal 、 Convert hex to decimal .
Section V number
1)C The language is only eight 、 Ten 、 Hexadecimal , No binary . But at runtime , All the bases must be converted to binary for processing .( Twice in the exam )
a、C The octal rules in language should be 0 start .018 The value of is illegal , Octal is not 8 Of , Meet 8 Into the 1.
b、C The hexadecimal rules in a language are as follows 0x start .
2) The legal writing of decimals :C If there is a zero on both sides of the decimal point of the language , You don't have to write .
1.0 stay C It can be written as 1.
0.1 stay C Language can be written as .1.
3) The legal form of real data :
a、2.333e-1 It's legal , And the data is 2.333×10-1.
b、 Test formula :e front e There must be a few in the future ,e Must be an integer after . Please combine the examples in the book .
4) The integer is usually 4 Bytes , The character type is 1 Bytes , Double precision is generally 8 Bytes :
long int x; Express x It's a long one .
unsigned int x; Express x It's an unsigned integer .
The sixth 、 Seven quarter : Arithmetic expressions and assignment expressions
The core : The expression must have a number !
1、 Arithmetic expressions :+,-,*,/,%
Be sure to pay attention to :“/” If it's full size on both sides , The result is an integer . 3/2 The result is that 1.
“/” If one side is a decimal , So the result is a decimal . 3/2.0 The result is that 1.5
“%” Please note that the sign is the remainder , The examination is the easiest to count as a divisor .)% Both sides of the symbol are required to be integers . It's not a whole number .[ Be careful !!!]
2、 Assignment expression : The expression value is the leftmost value ,a=b=5; The expression is 5, Constant cannot be assigned .
1、int x=y=10: Wrong , Definition time , You can't assign values consecutively .
2、int x,y:
x=y=10; Yes , After definition , Can be assigned continuously .
3、 The left side of the assignment can only be a variable .
4、int x=7.7; Yes ,x Namely 7
5、float x=7; Yes ,x Namely 7.0
3、 Compound assignment expression :
int a = 2;
a*=2+3; After completion of operation ,a The value of is 12.
Be sure to pay attention to , In the first 2+3 Put brackets on the top of . become (2+3) Re operation .
Compound statements must be used {};
4、 Self adding expression :
Self adding 、 Self reducing expression : hypothesis a=5,++a( Is for 6), a++( by 5);
The mechanism of operation :++a First add the value of the variable to 1, And then put the resulting value in the variable a in , Then use this ++a The value of the expression is 6, and a++ First, the value of the expression is 5, Then take it. a The value of plus 1 by 6,
And then put it in variables a in . the ++a and a++ After that, it will be used in the following program to a It's all variables a Medium 6 了 .
Test formula :++ Add before use ,++ Use first and then add .
5、 Comma expression :
The lowest priority . The value of the expression the value of the expression to the far right of the comma .
(2,3,4) The value of the expression of is 4.
z=(2,3,4)( The whole assignment expression ) This is the time z The value of is 4.( It's a little difficult !)
z= 2,3,4 ( The whole thing is a comma expression ) This is the time z The value of is 2.
Add :
1、 Empty statements cannot be executed at will , Will lead to logical errors .
2、 Notes are the key points of exams in recent years , The note is not C Language , No running time , There's no semicolon . You can't nest !
3、 Cast :
It must be (int)a No int(a), Note that there must be brackets on the type .
Be careful (int)(a+b) and (int)a+b The difference between . The front is a a+b The transformation of , After that is the a Transformation plus b.
4、 Three cases of rounding and deciphering :
1、int a =1.6;
2、(int)a;
3、1/2; 3/2;
4. Don't lose decimals , Prefix the corresponding format .2 Retain 2 position , rounding
Section 8 、 character
1) The legal form of character data ::
'1' It is the character that accounts for — Bytes ,"1" It's a string that takes up two bytes ( Contains an end symbol ).
'0' Of ASCII The value is expressed as 48,'a' Of ASCII Values are 97,'A' Of ASCII Values are 65.
The general test represents the form of a single character error :'65' "1"
Characters can be used for arithmetic operations , remember : '0'-0=48
How to convert capital letters and lowercase letters : 'A'+32='a' They are usually different from each other 32.
2) Escape character :
Escape characters are divided into general escape characters 、 Octal escape character 、 Hexadecimal escape character .
General escape characters : recite \0、 \n、 \’、 \”、 \\.
Octal escape character : ‘\141’ It's legal. , Leading 0 It can't be written .
Hexadecimal escape character :’\\x6d’ It's legal , Leading 0 Can't write , also x It's lowercase .
3、 Character types and integers are close relatives : The two have great similarities
char a = 65 ;
printf(“%c”,a); The output is :a
printf(“%d”, a); The output is :65
Chapter nine 、 An operation
1) The examination of bit operation : There will be one or two questions .
The general treatment : Almost all the problems of bit operation should be handled according to this process ( Change decimal system into binary system and then decimal system ).
example 1: char a = 6,b;
b = a<<2; The calculation of this kind of problem is to put a Decimal system of 6 Into binary , And then do bit arithmetic .
example 2: Remember that , Bitwise sign of XOR ”^”.0 Exclusive or 1 obtain 1.
0 Exclusive or 0 obtain 0. Two girls can't be born .
Test memory method : A man (1)— Woman (0) To have a baby (1).
example 3: When the data is not discarded ,<< Move one bit to the left to multiply by 2;>> Move one bit to the right to divide by 2
And that's all for today , Remember to praise the collection , Share and forward , Pay attention to the little brother ! Last , If you want to learn or are learning C/C++ Programming , You can join Xiaobian Programming learning C/C++ Penguin circle
边栏推荐
- 融合迁移学习与文本增强的中文成语隐喻知识识别与关联研究
- 线程知识总结
- Negative ring
- Thread knowledge summary
- Named entity recognition of Chinese electronic medical records based on Roberta WwM dynamic fusion model
- This points to problems, closures, and recursion
- LeetCode·每日一题·592.分数加减运算·模拟
- Unity3D学习笔记10——纹理数组
- C language layered understanding (C language array)
- SLAM综述阅读笔记六:基于图像语义的SLAM调研:移动机器人自主导航面向应用的解决方案 2020
猜你喜欢

Advanced MySQL III. storage engine

Cultural tourism and data collection | travel to Yunnan in an artistic way
![[luogu_p5431] [template] multiplicative inverse 2 [number theory]](/img/e0/a710e22e28cc1ffa23666658f9ba13.png)
[luogu_p5431] [template] multiplicative inverse 2 [number theory]

Some key information about Max animation (shift+v)
![[note] logistic regression](/img/2b/07cc3c26b1b34fbf2f09edaa33668e.jpg)
[note] logistic regression

West test Shenzhen Stock Exchange listing: annual revenue of 240million, fund-raising of 900million, market value of 4.7 billion

One of yolox improvements: add CBAM, Se, ECA attention mechanism

Flat die cutting machine

Navicate报错access violation at address 00000000

Slam overview Reading Note 6: slam research based on image semantics: application-oriented solutions for autonomous navigation of mobile robots 2020
随机推荐
Negative ring
基于招聘广告的岗位人才需求分析框架构建与实证研究
Mining enterprise association based on Enterprise Knowledge Map
Some key information about Max animation (shift+v)
Cognition -- classic of the road to success of hardware engineers
万字详解 Google Play 上架应用标准包格式 AAB
Navicate报错access violation at address 00000000
次小生成树【模板】
Redis
Cultural tourism and data collection | travel to Yunnan in an artistic way
Architecture - the sublimation of MVC
Thread knowledge summary
Lesson 3: reverse word order
Carla notes (04) - client and world (create client, connect world, batch object, set weather, set lights, world snapshots)
Slam overview Reading Note 4: a survey on deep learning for localization and mapping: towards the age of spatial 2020
Zhishang technology IPO meeting: annual revenue of 600million, book value of accounts receivable of 270Million
How to return to the parent directory with commands
Understand JS execution context in an article
[related contents of multithreading]
一篇文章看懂JS执行上下文