当前位置:网站首页>The fifth day of learning C language
The fifth day of learning C language
2022-07-27 09:16:00 【ruin987】
#include<stdio.h>
void sum(int begin, int end)
{
int i;
int sum = 0;
for (i = begin; i <= end; i++)
{
sum + 1;
}
printf("%d To %d And is %d\n", begin, end, sum);
}
int main()
{
sum(1, 10);
sum(20, 30);
sum(35, 45);
return 0;
}As a pointer to a parameter
void f( int* p)
Get the address of a variable when called ;
int i=0; f(&i);
In the function, you can access the external... Through this pointer i
0 Address
Of course you have 0 Address , however 0 Address is usually an address that can't be touched
So your pointer should not have 0 value
So you can use 0 Address to show special things :
The returned pointer is invalid
The pointer is not really initialized ( Initialize to 0)
NULL Is a predefined symbol , Express 0 Address
Some compilers don't want you to use 0 To express 0 Address
Pointer type conversion
void* A pointer indicating that you don't know what to point to
Calculate with char* identical ( But it's not connected )
Pointers can also convert types
int*p=&i;void*q=(void*)p;
It doesn't change p Type of variable referred to , But let later generations pass through with different eyes p Look at the variables he refers to
const stay * Before and after
const int*p1=&i;( What he refers to cannot be modified )
int const* p2=&i;( It is also what he refers to that cannot be modified )
int *constp3=&i( The pointer cannot be modified )
count Array
count int a[]={1,2,3,4,5,6,};
The array variable is already const Pointer. , there const Indicates that each cell of the array is const int
So it has to be assigned by initialization
边栏推荐
- Tensorflow loss function
- 被三星和台积电挤压的Intel终放下身段,为中国芯片定制芯片工艺
- Explanation of binary tree
- Pytorch custom CUDA operator tutorial and runtime analysis
- [C language - zero foundation lesson 8] circular structure and break continue
- [C language - zero foundation lesson 9] love and hate in functions
- Antdesign a-modal自定义指令实现拖拽放大缩小
- 网易笔试之解救小易——曼哈顿距离的典型应用
- A survey of robust lidar based 3D object detection methods for autonomous driving paper notes
- [C language _ review _ learn Lesson 2] what is base system? How to convert between hexadecimals
猜你喜欢

A survey of robust lidar based 3D object detection methods for autonomous driving paper notes

Specific methods and steps for Rockwell AB PLC to establish communication with PLC through rslinx classic

CUDA programming-04: CUDA memory model

8 kinds of visual transformer finishing (Part 2)

500报错

Five kinds of 2D attention finishing (non local, criss cross, Se, CBAM, dual attention)

Understand various IOU loss functions in target detection

B tree

C# 窗体应用常用基础控件讲解(适合萌新)

ctfshow 终极考核
随机推荐
500 error reporting
易语言编程: 让读屏软件可获取标签控件的文本
Mangodb simple to use
Babbitt | yuan universe daily must read: Guangzhou Nansha released the "Yuan universe nine" measures, and the platform can obtain up to 200million yuan of financial support
5G没能拉动行业发展,不仅运营商失望了,手机企业也失望了
Huawei machine test question: Martian computing JS
Specific methods and steps for Rockwell AB PLC to establish communication with PLC through rslinx classic
JS call and apply
ES6 new - function part
[C language - zero basis _ study _ review _ lesson 5] operational properties of basic operators
DNS domain name space
微信安装包从0.5M暴涨到260M,为什么我们的程序越来越大?
Pyqt5 rapid development and practice 4.1 qmainwindow
DNS域名空间
Storage and computing engine
被三星和台积电挤压的Intel终放下身段,为中国芯片定制芯片工艺
PyTorch自定义CUDA算子教程与运行时间分析
Programming style
linux安装和远程连接mysql记录
New year's goals! The code is more standardized!