当前位置:网站首页>函数(易错)
函数(易错)
2022-07-05 04:16:00 【曹乐乐爱学习】
函数传递数组,指针时候,传递的只是起始地址。
例:1维数组求和
发现,求的数组大小,等于2?而不是5?
解释一下2是怎么来的:因为我的是64位机,而sizeof(int)大家都知道,4字节,32位;所以sizeof(p),应该就是64;为什么是64?因为第一句话我就说了:函数传递数组,指针时候,传递的只是一个地址,64位机的地址,不就是64bit嘛。
所以,要把数组(指针)的大小,也要以形参的形式传递到函数里面来。
--------------------------------------------------------------------------------------------------------------------
字符数组,由于末尾有'\0',所以有时候传参时候可以不需要传数组大小
例:删除字符串中的空格
边栏推荐
- Is "golden nine and silver ten" the best time to find a job? Not necessarily
- American 5g open ran suffered another major setback, and its attempt to counter China's 5g technology has failed
- The development of mobile IM based on TCP still needs to keep the heartbeat alive
- Threejs Internet of things, 3D visualization of farms (II)
- 【虚幻引擎UE】实现UE5像素流部署仅需六步操作少走弯路!(4.26和4.27原理类似)
- The order of LDS links
- lds链接的 顺序问题
- Differences among 10 addressing modes
- Online sql to excel (xls/xlsx) tool
- C language course setting: cinema ticket selling management system
猜你喜欢
Interview byte, pass the exam and directly work on three sides. As a result, I found an architect to hang me?
[phantom engine UE] the difference between running and starting, and the analysis of common problems
【虚幻引擎UE】实现UE5像素流部署仅需六步操作少走弯路!(4.26和4.27原理类似)
[brush questions] BFS topic selection
IronXL for . NET 2022.6
【虛幻引擎UE】實現UE5像素流部署僅需六步操作少走彎路!(4.26和4.27原理類似)
Plasticscm enterprise crack
How to get the first few pieces of data of each group gracefully
小程序中实现文章的关注功能
How to realize real-time audio and video chat function
随机推荐
The new project Galaxy token just announced by coinlist is gal
长度为n的入栈顺序的可能出栈顺序种数
长度为n的入栈顺序的可能出栈顺序
如何实现实时音视频聊天功能
Realize the attention function of the article in the applet
kubernetes集群之调度系统
[finebi] the process of making custom maps using finebi
JVM garbage collection
Scheduling system of kubernetes cluster
[illusory engine UE] method to realize close-range rotation of operating objects under fuzzy background and pit recording
【虚幻引擎UE】实现测绘三脚架展开动画制作
CTF stegano practice stegano 9
How does the applet solve the rendering layer network layer error?
Sequelize. JS and hasmany - belongsto vs hasmany in serialize js
C语言课设:影院售票管理系统
DFS and BFS concepts of trees and graphs
Learning notes 8
Enterprise level: spire Office for . NET:Platinum|7.7. x
Threejs Internet of things, 3D visualization of farms (I)
Phpmailer reported an error: SMTP error: failed to connect to server: (0)