当前位置:网站首页>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 .
边栏推荐
- Leetcode: Shortest Word Distance II
- lv_font_conv离线转换
- Common PHP interview questions (1) (written PHP interview questions)
- Install PHP extension spoole
- The elimination strategy of redis
- Redis' transaction mechanism
- 做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
- I spring and autumn blasting-1
- First PR notes
- Coding devsecops helps financial enterprises run out of digital acceleration
猜你喜欢

Detailed explanation of QT creator breakpoint debugger

Mysql---- function

Ecotone technology has passed ISO27001 and iso21434 safety management system certification

JS knowledge points-01

做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史

机器学习笔记 - 灰狼优化

当代人的水焦虑:好水究竟在哪里?

数学建模之层次分析法(含MATLAB代码)

Fr exercise topic --- comprehensive question

ionic cordova项目修改插件
随机推荐
lv_ font_ Conv offline conversion
Can gbase 8A view the location of SQL statement history?
1330:【例8.3】最少步数
OSI 七层模型
JMeter performance test: serveragent resource monitoring
Magic methods and usage in PHP (PHP interview theory questions)
Good article inventory
The difference between SQL Server char nchar varchar and nvarchar
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
Super wow fast row, you are worth learning!
I include of spring and Autumn
爱可可AI前沿推介(7.5)
Bugku alert
漫画:优秀的程序员具备哪些属性?
超越PaLM!北大碩士提出DiVeRSe,全面刷新NLP推理排行榜
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
String modification problem solving Report
Stm32+bh1750 photosensitive sensor obtains light intensity
sql server学习笔记
Easyocr character recognition
https://blog.csdn.net/a746742897/article/details/77543029