当前位置:网站首页>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
边栏推荐
- Replace restricts the text box to regular expressions of numbers, numbers, letters, etc
- [C language - zero foundation lesson 7] sequential structure and selection structure
- [acl2020] a novel method of component syntax tree serialization
- 【每日算法Day 94】经典面试题:机器人的运动范围
- [C language _ review _ learn Lesson 2] what is base system? How to convert between hexadecimals
- 软件测试功能测试全套常见面试题【功能测试-零基础】必备4-1
- Principle of flex:1
- [daily algorithm day 96] Tencent interview question: merge two ordered arrays
- 网易笔试之解救小易——曼哈顿距离的典型应用
- STL container -- Application of set set
猜你喜欢
![[C language - zero foundation lesson 6] input and output sentence format and compound sentence](/img/d5/b9935a37b634db7f5740779009e44f.png)
[C language - zero foundation lesson 6] input and output sentence format and compound sentence

Music experience ceiling! Emotional design details of 14 Netease cloud music

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

async/await的执行顺序以及宏任务和微任务

Explanation of common basic controls for C # form application (suitable for Mengxin)

拍卖行做VC,第一次出手就投了个Web3
![[micro service ~sentinel] sentinel dashboard control panel](/img/df/2fbe7826ea2b80a81d29351052ae28.png)
[micro service ~sentinel] sentinel dashboard control panel

一些实用、常用、效率越来越高的 Kubernetes 别名
![[acl2020] a novel method of component syntax tree serialization](/img/24/b8ec489966f7b1deef82b2eefa4d1b.png)
[acl2020] a novel method of component syntax tree serialization

flex布局 (实战小米官网)
随机推荐
Tensorflow package tf.keras module construction and training deep learning model
5G没能拉动行业发展,不仅运营商失望了,手机企业也失望了
软件测试功能测试全套常见面试题【功能测试-零基础】必备4-1
基于ArkUI eTS开发的坚果食谱(NutRecipes
pollFirst(),pollLast(),peekFirst(),peekLast()
BOM的常用操作和有关获取页面/窗口高度、宽度及滚动的兼容性写法
Cross domain and processing cross domain
The difference between computed and watch
Svg drawing curve
linux下安装oracle,本地PL/SQL连接Linux下的oracle导入表并新建用户和密码
Five kinds of 2D attention finishing (non local, criss cross, Se, CBAM, dual attention)
被三星和台积电挤压的Intel终放下身段,为中国芯片定制芯片工艺
BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans
Two tips in arkui framework
二叉树讲解
全排列递归思路整理
Pytorch custom CUDA operator tutorial and runtime analysis
[C language - zero foundation lesson 10] adventure of array Kingdom
As a VC, the auction house invested Web3 for the first time
Unity3d 2021 software installation package download and installation tutorial