当前位置:网站首页>函數(易錯)
函數(易錯)
2022-07-05 04:17:00 【曹樂樂愛學習】
函數傳遞數組,指針時候,傳遞的只是起始地址。
例:1維數組求和
發現,求的數組大小,等於2?而不是5?
解釋一下2是怎麼來的:因為我的是64比特機,而sizeof(int)大家都知道,4字節,32比特;所以sizeof(p),應該就是64;為什麼是64?因為第一句話我就說了:函數傳遞數組,指針時候,傳遞的只是一個地址,64比特機的地址,不就是64bit嘛。
所以,要把數組(指針)的大小,也要以形參的形式傳遞到函數裏面來。
--------------------------------------------------------------------------------------------------------------------
字符數組,由於末尾有'\0',所以有時候傳參時候可以不需要傳數組大小
例:删除字符串中的空格
边栏推荐
- Use object composition in preference to class inheritance
- Longyuan war "epidemic" 2021 network security competition web easyjaba
- provide/inject
- Judge whether the stack order is reasonable according to the stack order
- lds链接的 顺序问题
- Sequence diagram of single sign on Certification Center
- [uniapp] system hot update implementation ideas
- 陇原战“疫“2021网络安全大赛 Web EasyJaba
- How to remove installed elpa package
- Interview related high-frequency algorithm test site 3
猜你喜欢
“金九银十”是找工作的最佳时期吗?那倒未必
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
10种寻址方式之间的区别
Containerd series - detailed explanation of plugins
【虚幻引擎UE】运行和启动的区别,常见问题分析
Sequence diagram of single sign on Certification Center
Use of vscode software
Interview related high-frequency algorithm test site 3
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
MacBook installation postgresql+postgis
随机推荐
快手、抖音、视频号交战内容付费
Ctfshow web entry code audit
OWASP top 10 vulnerability Guide (2021)
机器学习 --- 决策树
Open graph protocol
Threejs rendering obj+mtl model source code, 3D factory model
The scale of computing power in China ranks second in the world: computing is leaping forward in Intelligent Computing
laravel8 导出Excle文件
在线SQL转Excel(xls/xlsx)工具
机器学习 --- 神经网络
Machine learning decision tree
How to realize real-time audio and video chat function
【科普】热设计基础知识:5G光器件之散热分析
Why can't all browsers on my computer open web pages
[finebi] the process of making custom maps using finebi
Threejs Internet of things, 3D visualization of factory
How to solve the problem that easycvr changes the recording storage path and does not generate recording files?
Wechat applet development process (with mind map)
About the project error reporting solution of mpaas Pb access mode adapting to 64 bit CPU architecture
About the prompt loading after appscan is opened: guilogic, it keeps loading and gets stuck. My personal solution. (it may be the first solution available in the whole network at present)