当前位置:网站首页>函數(易錯)
函數(易錯)
2022-07-05 04:17:00 【曹樂樂愛學習】
函數傳遞數組,指針時候,傳遞的只是起始地址。
例:1維數組求和
發現,求的數組大小,等於2?而不是5?
解釋一下2是怎麼來的:因為我的是64比特機,而sizeof(int)大家都知道,4字節,32比特;所以sizeof(p),應該就是64;為什麼是64?因為第一句話我就說了:函數傳遞數組,指針時候,傳遞的只是一個地址,64比特機的地址,不就是64bit嘛。
所以,要把數組(指針)的大小,也要以形參的形式傳遞到函數裏面來。
--------------------------------------------------------------------------------------------------------------------
字符數組,由於末尾有'\0',所以有時候傳參時候可以不需要傳數組大小
例:删除字符串中的空格
边栏推荐
- On the day 25K joined Tencent, I cried
- MacBook installation postgresql+postgis
- Bit operation skills
- Differences among 10 addressing modes
- After the deployment of web resources, the navigator cannot obtain the solution of mediadevices instance (navigator.mediadevices is undefined)
- [understand series after reading] 6000 words teach you to realize interface automation from 0 to 1
- [finebi] the process of making custom maps using finebi
- Wechat applet development process (with mind map)
- 机器学习 --- 决策树
- WGS84 coordinate system, web Mercator, gcj02 coordinate system, bd09 coordinate system - brief introduction to common coordinate systems
猜你喜欢
Realize the attention function of the article in the applet
快手、抖音、视频号交战内容付费
laravel8 导出Excle文件
Three level linkage demo of uniapp uview u-picker components
Containerd series - detailed explanation of plugins
指针函数(基础)
Uni app common functions /api
Laravel8 export excel file
Online text line fixed length fill tool
如何实现实时音视频聊天功能
随机推荐
provide/inject
快手、抖音、视频号交战内容付费
Why do big companies such as Baidu and Alibaba prefer to spend 25K to recruit fresh students rather than raise wages by 5K to retain old employees?
Containerd series - detailed explanation of plugins
How to solve the problem that easycvr changes the recording storage path and does not generate recording files?
[thingsboard] how to replace the homepage logo
【虚幻引擎UE】实现背景模糊下近景旋转操作物体的方法及踩坑记录
我国算力规模排名全球第二:计算正向智算跨越
Wechat applet development process (with mind map)
Kwai, Tiktok, video number, battle content payment
A solution to the problem that variables cannot change dynamically when debugging in keil5
Number of possible stack order types of stack order with length n
Study notes 7
函数(易错)
Hexadecimal to octal
[uniapp] system hot update implementation ideas
【虚幻引擎UE】打包报错出现!FindPin错误的解决办法
[understand series after reading] 6000 words teach you to realize interface automation from 0 to 1
Interview byte, pass the exam and directly work on three sides. As a result, I found an architect to hang me?
DFS and BFS concepts of trees and graphs