当前位置:网站首页>Standard C language learning summary 3
Standard C language learning summary 3
2022-07-28 07:07:00 【c7473168】
Jump statements
goto
You can jump anywhere in the function
Tag name :
...
goto Tag name ;
It may break the designed branch or loop structure , Therefore, most companies prohibit the use of goto
But it is especially suitable for handling exceptions in driver programming
break
1、 stay switch Closed in case Execute the switch
2、 Out of the loop , You can only jump out of the current layer of loop
continue
End this cycle , Enter next cycle
return
1、 End function execution , The program jumps back to the place where the function is called and continues to execute
2、 Return a data to the caller of the function
Array
What is an array : The combination of variables , It is a way to define variables of the same type in batch
Definition : Type name Array name [ Number ];
int arr[5];
Use : Array name [ Subscript ];
Subscript : Starting from scratch Range : 0~ Number -1
arr[0] = 10 arr[4] *10
Traverse : And for Circular fit , Use a circular variable as the subscript of the array
initialization : Type name array name [ Number ] = {1,2,3,4...};
An array :
For program compilation , The efficiency compiler does not check the subscript of the array
Consequences of array out of bounds :
/* 1. Segment error ( The core has been dumped )
2. Everything is all right
3. Dirty data */
summary : In the process of using arrays , Always be careful not to cross the line
Two dimensional array :
A one-dimensional array is equivalent to arranging variables in a row , Access by number
A two-dimensional array is equivalent to arranging variables into
Traverse : Need and double-layer for Circular fit , The outer loop is responsible for traversing rows , The inner loop traverses a matrix , Access through row and column numbers
Variable length array :
When defining an array, use variables as the length of the array , The length of the array is uncertain during code compilation ,
The length of the array is finally determined when the definition statement of the array is run , This kind of array is called variable length array
Be careful : Once the length is determined , It can't be changed later
advantage : The length of the array can be determined according to the actual situation , In order to save memory space
shortcoming : Unable to initialize , Because initialization occurs during program compilation
边栏推荐
猜你喜欢
随机推荐
Wechat applet custom compilation mode
起点中文网 字体反爬技术 网页可以显示数字字母 网页代码是乱码或空格
win下安装nessus
kali下安装nessus
Blue bridge code error ticket
开虚拟机KALI2022.2下安装GVM
Custom component -- pure data field & component life cycle
DNS domain name resolution
Group management and permission management
视频格式基础知识:让你了解MKV、MP4、H.265、码率、色深等等
Network - network layer
MOOC翁恺C语言第八周:指针与字符串:1.指针2.字符类型3.字符串4.字符串计算
Uni app double click event simulation
一、PXE概述和安装
JSON notes
Custom components -- slots
shell---循环语句练习
远程访问云服务器上Neo4j等服务的本地网址
MySQL查询父节点下面的所有子孙节点,查询用户列表时多级(公司)部门处理,根据反射,递归树形结构工具类
MOOC Weng Kai C language week 6: arrays and functions: 1. Arrays 2. Definition and use of functions 3. Parameters and variables of functions 4. Two dimensional arrays









