当前位置:网站首页>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 !
边栏推荐
- Structured machine learning project (I) - machine learning strategy
- Management system itclub (Part 1)
- 《7天學會Go並發編程》第7天 go語言並發編程Atomic原子實戰操作含ABA問題
- Interview question 3 of software test commonly used by large factories (with answers)
- Summary of Web testing and app testing by bat testing experts
- 不外泄的测试用例设计秘籍--模块测试
- Vue+MySQL实现登录注册案例
- PHP连接数据库实现用户注册登录功能
- Codeforces Round #716 (Div. 2)
- DCC888 :Register Allocation
猜你喜欢

Figure countdownlatch and cyclicbarrier based on AQS queue

Crontab scheduled task common commands

average-population-of-each-continent

Ellipsis after SQLite3 statement Solutions for
![\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?

Use Fiddler to simulate weak network test (2g/3g)

Crawler notes (3) -selenium and requests

Character interception triplets of data warehouse: substrb, substr, substring

二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)

Summary of Web testing and app testing by bat testing experts
随机推荐
清华大学教授:软件测试已经走入一个误区——“非代码不可”
Experience sharing of meituan 20K Software Test Engineers
MONTHS_BETWEEN函数使用
Figure countdownlatch and cyclicbarrier based on AQS queue
Introduction to ARCS Model
YOLOv6:又快又准的目标检测框架开源啦
C # QR code generation and recognition, removing white edges and any color
登录凭证(cookie+session和Token令牌)
Système de gestion - itclub (II)
Is it safe to open a stock account through the account opening link given by the CICC securities manager? I want to open an account
Contest 2050 and Codeforces Round #718 (Div. 1 + Div. 2)
正则表达式
使用sqlite3语句后出现省略号 ... 的解决方法
Common APIs (Methods) for scope -number and string
Vue+mysql login registration case
Basic data type and complex data type
结构化机器学习项目(二)- 机器学习策略(2)
宏任务、微任务理解
Basic knowledge of loop traversal and function
年薪50W+的测试大鸟都在用这个:Jmeter 脚本开发之——扩展函数