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

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

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

边栏推荐
- What is test development? Why do so many companies hire test developers now?
- Three level linkage demo of uniapp uview u-picker components
- 蛇形矩阵
- 网络安全-记录web漏洞修复
- [phantom engine UE] the difference between running and starting, and the analysis of common problems
- provide/inject
- Network security - record web vulnerability fixes
- 【虚幻引擎UE】实现测绘三脚架展开动画制作
- Longyuan war "epidemic" 2021 network security competition web easyjaba
- Rome链分析
猜你喜欢

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

About the recent experience of writing questions

Looking back on 2021, looking forward to 2022 | a year between CSDN and me

Three level linkage demo of uniapp uview u-picker components

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

Threejs Internet of things, 3D visualization of factory

A solution to the problem that variables cannot change dynamically when debugging in keil5

C language course setting: cinema ticket selling management system

Threejs implements labels and displays labels with custom styles

【虛幻引擎UE】實現UE5像素流部署僅需六步操作少走彎路!(4.26和4.27原理類似)
随机推荐
mysql的七种join连接查询
Threejs loads the city obj model, loads the character gltf model, and tweetjs realizes the movement of characters according to the planned route
Use threejs to create geometry, dynamically add geometry, delete geometry, and add coordinate axes
CTF stegano practice stegano 9
Summary of scene design
Threejs Internet of things, 3D visualization of factory
指针函数(基础)
A應用喚醒B應該快速方法
Threejs factory model 3DMAX model obj+mtl format, source file download
Serpentine matrix
在线SQL转Excel(xls/xlsx)工具
File upload bypass summary (upload labs 21 customs clearance tutorial attached)
Hexadecimal to decimal
TPG x AIDU|AI领军人才招募计划进行中!
Possible stack order of stack order with length n
Online sql to excel (xls/xlsx) tool
Uni app change the default component style
Containerd series - what is containerd?
【虚幻引擎UE】实现背景模糊下近景旋转操作物体的方法及踩坑记录
What is the reason why the webrtc protocol video cannot be played on the easycvr platform?