当前位置:网站首页>函数(易错)
函数(易错)
2022-07-05 04:16:00 【曹乐乐爱学习】
函数传递数组,指针时候,传递的只是起始地址。
例:1维数组求和

发现,求的数组大小,等于2?而不是5?
解释一下2是怎么来的:因为我的是64位机,而sizeof(int)大家都知道,4字节,32位;所以sizeof(p),应该就是64;为什么是64?因为第一句话我就说了:函数传递数组,指针时候,传递的只是一个地址,64位机的地址,不就是64bit嘛。
所以,要把数组(指针)的大小,也要以形参的形式传递到函数里面来。

--------------------------------------------------------------------------------------------------------------------
字符数组,由于末尾有'\0',所以有时候传参时候可以不需要传数组大小
例:删除字符串中的空格

边栏推荐
- 【UNIAPP】系统热更新实现思路
- 快手、抖音、视频号交战内容付费
- 3. Package the bottom navigation tabbar
- Pyqt pyside custom telescopic menu bar sharing (including tutorial)
- 【虚幻引擎UE】实现背景模糊下近景旋转操作物体的方法及踩坑记录
- Looking back on 2021, looking forward to 2022 | a year between CSDN and me
- Three level linkage demo of uniapp uview u-picker components
- 如何优雅的获取每个分组的前几条数据
- Phpmailer reported an error: SMTP error: failed to connect to server: (0)
- Containerd series - detailed explanation of plugins
猜你喜欢

快手、抖音、视频号交战内容付费

【虚幻引擎UE】实现UE5像素流部署仅需六步操作少走弯路!(4.26和4.27原理类似)

Interview related high-frequency algorithm test site 3

Plasticscm enterprise crack

User behavior collection platform

Fuel consumption calculator

Containerd series - what is containerd?

我国算力规模排名全球第二:计算正向智算跨越

CTF stegano practice stegano 9

Threejs implements labels and displays labels with custom styles
随机推荐
我国算力规模排名全球第二:计算正向智算跨越
【虛幻引擎UE】實現UE5像素流部署僅需六步操作少走彎路!(4.26和4.27原理類似)
What is test development? Why do so many companies hire test developers now?
Hexadecimal to decimal
Pyqt pyside custom telescopic menu bar sharing (including tutorial)
技术教程:如何利用EasyDSS将直播流推到七牛云?
Bit operation skills
Un réveil de l'application B devrait être rapide
MindFusion. Virtual Keyboard for WPF
学习MVVM笔记(一)
Wechat applet development process (with mind map)
mysql的七种join连接查询
Learning MVVM notes (1)
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
25K 入职腾讯的那天,我特么哭了
Threejs Internet of things, 3D visualization of farm (III) model display, track controller setting, model moving along the route, model adding frame, custom style display label, click the model to obt
快手、抖音、视频号交战内容付费
Longyuan war "epidemic" 2021 network security competition web easyjaba
ActiveReportsJS 3.1 VS ActiveReportsJS 3.0
The new project Galaxy token just announced by coinlist is gal