当前位置:网站首页>函數(易錯)
函數(易錯)
2022-07-05 04:17:00 【曹樂樂愛學習】
函數傳遞數組,指針時候,傳遞的只是起始地址。
例:1維數組求和

發現,求的數組大小,等於2?而不是5?
解釋一下2是怎麼來的:因為我的是64比特機,而sizeof(int)大家都知道,4字節,32比特;所以sizeof(p),應該就是64;為什麼是64?因為第一句話我就說了:函數傳遞數組,指針時候,傳遞的只是一個地址,64比特機的地址,不就是64bit嘛。
所以,要把數組(指針)的大小,也要以形參的形式傳遞到函數裏面來。

--------------------------------------------------------------------------------------------------------------------
字符數組,由於末尾有'\0',所以有時候傳參時候可以不需要傳數組大小
例:删除字符串中的空格

边栏推荐
- C语言课设:影院售票管理系统
- Seven join join queries of MySQL
- A real day for Beijing programmers!!!!!
- Three level linkage demo of uniapp uview u-picker components
- Clickpaas low code platform
- 如何实现实时音视频聊天功能
- Containerd series - what is containerd?
- Threejs Internet of things, 3D visualization of farms (I)
- 美国5G Open RAN再遭重大挫败,抗衡中国5G技术的图谋已告失败
- Convert Boolean to integer value PHP - Convert Boolean to integer value PHP
猜你喜欢

TPG x AIDU|AI领军人才招募计划进行中!

Threejs factory model 3DMAX model obj+mtl format, source file download

【虚幻引擎UE】实现测绘三脚架展开动画制作

基于TCP的移动端IM即时通讯开发仍然需要心跳保活

行为感知系统

Burpsuite grabs app packets

【科普】热设计基础知识:5G光器件之散热分析

【thingsboard】替换首页logo的方法

EasyCVR平台出现WebRTC协议视频播放不了是什么原因?

Threejs Internet of things, 3D visualization of farms (I)
随机推荐
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
How to get the first few pieces of data of each group gracefully
[brush questions] BFS topic selection
Bit operation skills
Rust blockchain development - signature encryption and private key public key
【thingsboard】替换首页logo的方法
As soon as I write the code, President Wang talks with me about the pattern all day
Pyqt5 displays file names and pictures
Wechat applet development process (with mind map)
What is the reason why the webrtc protocol video cannot be played on the easycvr platform?
Threejs Internet of things, 3D visualization of factory
【虚幻引擎UE】实现背景模糊下近景旋转操作物体的方法及踩坑记录
Why can't all browsers on my computer open web pages
[phantom engine UE] the difference between running and starting, and the analysis of common problems
About the recent experience of writing questions
Get to know MySQL connection query for the first time
provide/inject
Serpentine matrix
网络安全-记录web漏洞修复
A application wakes up B should be a fast method