当前位置:网站首页>Summary of the second lesson
Summary of the second lesson
2022-07-05 15:25:00 【Houli crab 670】
1. Constant
There are four kinds of constants , They are literal constants ,const Defined constant ,define Defined identity constants and enumeration constants .
Literal constants
Literal constants are literal constants , Such as 1,2,3,4,"ahsbb"'a', These are literal constants .
const Defined constant
Such as const int a=3, This defines a constant variable , But here's the thing const Just make it unchangeable , And its essence is variable . Such as (const int a=3;char arr[a]={1,2,3}) Theoretically, this code can run successfully , But it still doesn't work , because a The essence of is a variable , And the brackets in the array should be constants , So it can't run .
define Defined identity constant
Like this, you define an identity constant , And here you can successfully run the instructions define Definition Of Constant. .
Enumeration constants
Enumeration constants like this , And the result of the program output is 0, Because I'm not right male Assign initial value to , So it's from 0 At the beginning . So the keyword of enumerating constants is enum.
2. character string
What is the difference between outputting strings one by one and outputting strings directly
Like the first one (arr1) String output , The result is consistent with the expectation , But the second kind has deviation . Why? ?
First of all, let me explain %s The output rules of : Keep outputting until you encounter '\0' Output ends .
And the first string is input into the character array (arr1) In the middle of the day , stay 'd' A... Is automatically entered after '\0', So normal output .
The second one is (arr2) Direct input 'a','b','c','d' No input '\0' So there's a mess .
Empathy , Library function strlen Also encountered '\0' end , But here's the thing strlen Not put '\0' Count into the length , And if you want to use without warning, you need to add a header file in front #include <string.h>. Last ,strlen Only string length can be calculated , and sizeof It's different .
3. Escape character
The last two are relatively important and relatively difficult , For example, what is the answer of the following code
The answer is 14.
because '\t' Represents a character ( Horizontal tabs ),'\62' It represents a two digit octal number ascii( Corresponding 49), because \628 Already exceeded ascii The maximum of , So I just took \62, That is to say 1. So the running result is 14.
Explain the last two escape characters above :\ddd It doesn't have to have three octal numbers , An octal number can also .
Empathy ,\xdd The same goes for , Similarly, three hexadecimal numbers are not necessary , One is also possible .
4. Select statement , Loop statement , Knowledge of functions and arrays
Is to simply understand , No deep research , So I won't elaborate too much here .
5. Monocular operator and binocular operator
Generally speaking, monocular operator means that there is only one variable in the left and right operations , Such as "++","--" And so on. . Binocular operators are two variables that operate on the left and right , Such as "+","-" wait , Also, there is no deep study , So here is just a simple explanation .
边栏推荐
- Common PHP interview questions (1) (written PHP interview questions)
- P1451 求细胞数量/1329:【例8.2】细胞
- 机器学习框架简述
- What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?
- 【jvm】运算指令
- sql server学习笔记
- Misc Basic test method and knowledge points of CTF
- 华为哈勃化身硬科技IPO收割机
- OSI seven layer model
- JS topic - console log()
猜你喜欢
Super wow fast row, you are worth learning!
1330:【例8.3】最少步数
Nine hours, nine people, nine doors problem solving Report
Bugku alert
12 MySQL interview questions that you must chew through to enter Alibaba
Usage and usage instructions of JDBC connection pool
Machine learning notes - gray wolf optimization
Misc Basic test method and knowledge points of CTF
MySQL 巨坑:update 更新慎用影响行数做判断!!!
P1451 calculate the number of cells / 1329: [example 8.2] cells
随机推荐
Leetcode: Shortest Word Distance II
I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
Common redis data types and application scenarios
ionic cordova项目修改插件
计算中间件 Apache Linkis参数解读
JS knowledge points-01
Crud de MySQL
1330: [example 8.3] minimum steps
sql server学习笔记
Ctfshow web entry command execution
[recruitment position] infrastructure software developer
Common MySQL interview questions
Easyocr character recognition
Common PHP interview questions (1) (written PHP interview questions)
Au - delà du PARM! La maîtrise de l'Université de Pékin propose diverse pour actualiser complètement le classement du raisonnement du NLP
Creation and optimization of MySQL index
Usage and usage instructions of JDBC connection pool
Install PHP extension spoole
Talk about your understanding of microservices (PHP interview theory question)
Your childhood happiness was contracted by it