当前位置:网站首页>First knowledge of the second bullet of C language
First knowledge of the second bullet of C language
2022-06-27 22:40:00 【Meow meow more】
List of articles
One . Constant
Constant : Describe invariant quantities .C Constants in languages are divided into the following categories : Literal constants const Modified constant variable #define Defined identifier constant Enumeration constants .
1. Literal constants : 30; 3.14;‘w’ character ;“abc” character string ;
2.const Modified constant variable 
const Embellished a No output 20, If there is no const Will output 20, Make variable a Properties with constants
3.#define Defined identifier constant 
Output 100 100 define The identifier is defined MAX So you can output
4. Enumeration constants
Can't change 
Two . character string + Escape character + notes
character string
int main()
{
//char Character type
//‘a’- character constants
char ch=‘w’; // Alphabet character w Put it in a character variable to define
//“abcdef”;- Called string 
//C There is no string type in the language
return 0;
}
How to save strings ?
Put it in the character array
char arr[10] -- Put... In the array 10 Characters ; for example :char arr[10]=“abcdef” This can store , The premise is that the space given in front is large enough perhaps char arr[]=“abcdef” -- This automatically determines the previous value according to the size of the subsequent string
A... Is hidden at the end of the string ’’
‘’ Flag for the end of the string 
The initialization of the arr1 Occupied 7 Space , Initialization arr2 Account for the 6 Space 
%s Print out characters 
arr1 and arr2 There is memory space before and after the , The output only accounts for a small part
arr1 The output is that because ’’ and arr2 The output of does not ’’, therefore arr2 The output is as shown in the figure , Until I find ’’ Before printing 
This is adding ’’ Then you can output the same

Want to run this program , Find the length of this string , If you use this function, you need to add a header file before it #include <string.h>
strlen Get the length of the string So it is 6
The above 7 Is the length of space occupied by this string (size of) Need to be 7
Escape character : Changed the meaning of the original characters
C An escape character specified in a language

Escape character
// Three letter words ( Early parsers )
) -->]
( -->[


When the path is printed, it must be
For horizontal tabs , amount to tab
Convert octal numbers to decimal numbers , Find the decimal representation of ASCII Value instead of character This is a character in the figure 

if C Nested annotations in a language can cause problems therefore C The annotation style of the language does not support nesting
//-C++ The annotation style of
Write comments for your own code when you write code in the future ( Comb your mind 、 Explain complex code )
3、 ... and . Select statement
if The choice statement of 
if…else if if( Expression is true ) execute if If false, execute else
C The language implements the selected statement :if…else Switch…
Four . Loop statement

5、 ... and . function

This is the corresponding function in mathematics . and C The corresponding functions in the language are as follows :
First of all, define a add function , hold int x int y To assign separately to n1 n2
add- Function name x y For function parameters {} In is the function body int Is the return type The above definition can also be changed to 
6、 ... and . Array

Originality is not easy. ; I also hope you guys can support !
边栏推荐
- Go from introduction to practice -- definition and implementation of behavior (notes)
- Crawler notes (3) -selenium and requests
- go语言切片Slice和数组Array对比panic: runtime error: index out of range问题解决
- 同花顺炒股软件可靠吗??安全嘛?
- 使用sqlite3语句后出现省略号 ... 的解决方法
- Learn to go concurrent programming in 7 days go language sync Application and implementation of cond
- [MySQL practice] query statement demonstration
- YOLOv6:又快又准的目标检测框架开源啦
- Figure countdownlatch and cyclicbarrier based on AQS queue
- Basic data type and complex data type
猜你喜欢

结构化机器学习项目(一)- 机器学习策略
![\W and [a-za-z0-9_], \Are D and [0-9] equivalent?](/img/96/2649c9cf95b06887b57fd8af2d41c2.png)
\W and [a-za-z0-9_], \Are D and [0-9] equivalent?

爬虫笔记(1)- urllib

管理系统-ITclub(上)

Dialogue with Qiao Xinyu: the user is the product manager of Wei brand, and zero anxiety defines luxury

管理系统-ITclub(中)

C # QR code generation and recognition, removing white edges and any color

YOLOv6:又快又准的目标检测框架开源啦

渗透学习-靶场篇-dvwa靶场详细攻略(持续更新中-目前只更新sql注入部分)
![[MySQL] database function clearance Tutorial Part 2 (window function topic)](/img/03/2b37e63d0d482d5020b7421ac974cb.jpg)
[MySQL] database function clearance Tutorial Part 2 (window function topic)
随机推荐
The "business and Application Security Development Forum" held by the ICT Institute was re recognized for the security capability of Tianyi cloud
Common APIs (Methods) for scope -number and string
MONTHS_ Between function use
《7天学会Go并发编程》第7天 go语言并发编程Atomic原子实战操作含ABA问题
Is flush stock trading software reliable?? Is it safe?
mysql中一对多关联,获取多表中最新一条数据
正则表达式
How to participate in openharmony code contribution
Test birds with an annual salary of 50w+ are using this: JMeter script development -- extension function
This set of steps for performance testing using JMeter includes two salary increases and one promotion
How to open an account for agricultural futures? How much is the handling charge for opening an account for futures? Who can give you a preferential handling charge?
Login credentials (cookie+session and token token)
二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
The problem of minimum modification cost in two-dimensional array [conversion question + shortest path] (dijkstra+01bfs)
哈希表-数组之和
PHP连接数据库实现用户注册登录功能
\w和[A-Za-z0-9_],\d和[0-9]等价吗?
go语言切片Slice和数组Array对比panic: runtime error: index out of range问题解决
深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图
average-population-of-each-continent