当前位置:网站首页>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 .
边栏推荐
- I collect multiple Oracle tables at the same time. After collecting for a while, I will report that Oracle's OGA memory is exceeded. Have you encountered it?
- Common PHP interview questions (1) (written PHP interview questions)
- JMeter performance test: serveragent resource monitoring
- ICML 2022 | explore the best architecture and training method of language model
- Install and configure Jenkins
- keep-alive
- Fr exercise topic - simple question
- PHP high concurrency and large traffic solution (PHP interview theory question)
- Magic methods and usage in PHP (PHP interview theory questions)
- Example of lvgl display picture
猜你喜欢

SQL Server learning notes

Ctfshow web entry explosion

Bugku's Eval

keep-alive

Interpretation of Apache linkage parameters in computing middleware

swiper. JS to achieve barrage effect

把 ”中台“ 的思想迁移到代码中去

OSI seven layer model

Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology

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
随机推荐
Crud de MySQL
qt creater断点调试程序详解
Your childhood happiness was contracted by it
数学建模之层次分析法(含MATLAB代码)
Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
lv_font_conv离线转换
String modification problem solving Report
Mysql---- function
Jmeter性能测试:ServerAgent资源监控
Array sorting num ranking merge in ascending order
Easyocr character recognition
Bugku's Ah Da
I include of spring and Autumn
你童年的快乐,都是被它承包了
Interpretation of Apache linkage parameters in computing middleware
Anaconda uses China University of science and technology source
如何将 DevSecOps 引入企业?
Hongmeng system -- Analysis from the perspective of business
复现Thinkphp 2.x 任意代码执行漏洞
Fr exercise topic --- comprehensive question
https://blog.csdn.net/a746742897/article/details/77543029