当前位置:网站首页>Summary of array knowledge points
Summary of array knowledge points
2022-06-29 07:48:00 【Mertrix_ ITCH】
C Language - Array summary
6、 ... and 、 Array
1. To define an array
Format : Type specifier Array name [ Constant expression ]
- 1.#define N 5 int X[2*N]
- 2.int N=10; int X[N]; //N Can't be a variable
- 3.int X[0…10]; // Illegal expression
- 4.int X[ ]; // Expression cannot be empty
2. Two dimensional array
Format : Type specifier Array name [ Constant expression 1] [ Constant expression 2]
* remarks : Constant expression 1 Not required . eg: int x[ ] [10]
3. Array processing functions <string.h>
- puts(s1): The string s1( With ’\0’ end ) Output to terminal ;
- gets(s1): Input a string from the terminal to the character array s1 in ;
- strcpy(s1,s2): take s2 Copy the contents of to s1 In your storage space , return s1 The first address ;
- strcat(s1,s2): take s2 Content in connects to s1 At the end of , And back to s1 The first address ;
- strlen(s1): Compute string s1 The length of ( With ’\0’ As an end sign ,’\0’ Do not count the array length !);
- strcmp(s1,s2): take s1、s2 Two strings from left to right ( Press ASCII Code size ) Compare character by character , Take the size of the first different character as the comparison result .【s1>s2 The return value is positive ;s1=s2 The return value is 0 ; s1<s2 The return value is negative 】
4. Example
void fun(char *t ,char *s)
{
while(*t!=0) t++; // Formal parameter pointer t The content of is not 0, be t increase 1, Until zero ;
while((*t++=*s++)!=0) // take s The indicated content is assigned to t The address referred to , Then add one to both , until t The contents referred to are 0. 【 amount to :strcat()】
}
边栏推荐
- Oracle 批量插入数据-插入民族数据
- Kingbasees coping with transaction rollback caused by too fast growth of table age
- 多态中的向上和向下转型
- SQL 注入绕过(六)
- Markdown skill tree (9): tables
- 感知健康生活 赋能无界连接 ——为OpenHarmony 3.1生态构建贡献芯海力量
- How to authorize subordinates?
- 101. 对称二叉树(递归与迭代方法)
- Suggestions on working methods and efficient work
- Problem solving -- > online OJ (13)
猜你喜欢
![Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200](/img/56/b300c0c3606dbc328e301092615bff.jpg)
Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200

Appium automation test foundation ADB common commands (III)

Interviewer: why does database connection consume resources? Where are the resources consumed?

Swin Transformer理论讲解

感知健康生活 赋能无界连接 ——为OpenHarmony 3.1生态构建贡献芯海力量

【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞

施努卡:3d机器视觉检测系统 3d视觉检测应用行业

ShapeShifter: Robust Physical Adversarial Attack on Faster R-CNN Object Detector

蓝桥杯——13届第二批试题解析

Appium automation test foundation ADB common commands (II)
随机推荐
SAP ui5 Beginner (I) Introduction
postman预处理/前置条件Pre-request
ES中配置ext.dic文件不生效的原因
软件测试鸾音鹤信
Selected Siemens PLC project example source code [300 sets in total]
Select distinct on statement in kingbasees
Detailed design of PLC program control system for washing machine
cv2.cvtColor
施努卡:视觉定位系统厂家 什么是视觉定位系统
101. symmetric binary tree (recursive and iterative methods)
Appium 环境搭建
Concurrent idempotent anti shake
Vulnhub's DC8 target
施努卡:3D视觉识别系统 3D视觉检测原理
MIPS instruction set and brief analysis
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
Wechat applet learning notes (summer vacation)
编译原理王者之路
【量化投资系统】因子处理安装talib
从Nacos客户端谈Nacos配置中心