当前位置:网站首页>函数(易错)
函数(易错)
2022-07-05 04:16:00 【曹乐乐爱学习】
函数传递数组,指针时候,传递的只是起始地址。
例:1维数组求和
发现,求的数组大小,等于2?而不是5?
解释一下2是怎么来的:因为我的是64位机,而sizeof(int)大家都知道,4字节,32位;所以sizeof(p),应该就是64;为什么是64?因为第一句话我就说了:函数传递数组,指针时候,传递的只是一个地址,64位机的地址,不就是64bit嘛。
所以,要把数组(指针)的大小,也要以形参的形式传递到函数里面来。
--------------------------------------------------------------------------------------------------------------------
字符数组,由于末尾有'\0',所以有时候传参时候可以不需要传数组大小
例:删除字符串中的空格
边栏推荐
猜你喜欢
Longyuan war "epidemic" 2021 network security competition web easyjaba
Use threejs to create geometry, dynamically add geometry, delete geometry, and add coordinate axes
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
如何优雅的获取每个分组的前几条数据
Online sql to excel (xls/xlsx) tool
NetSetMan pro (IP fast switching tool) official Chinese version v5.1.0 | computer IP switching software download
Network layer - forwarding (IP, ARP, DCHP, ICMP, network layer addressing, network address translation)
Plasticscm enterprise crack
SPI read / write flash principle + complete code
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
随机推荐
【虛幻引擎UE】實現UE5像素流部署僅需六步操作少走彎路!(4.26和4.27原理類似)
Scheduling system of kubernetes cluster
SPI read / write flash principle + complete code
The new project Galaxy token just announced by coinlist is gal
Number of possible stack order types of stack order with length n
Sequelize. JS and hasmany - belongsto vs hasmany in serialize js
Realize the attention function of the article in the applet
Pyqt5 displays file names and pictures
Containerd series - what is containerd?
Rome链分析
机器学习 --- 决策树
北京程序员的真实一天!!!!!
[thingsboard] how to replace the homepage logo
Ffmepg usage guide
Use threejs to create geometry and add materials, lights, shadows, animations, and axes
User behavior collection platform
Threejs Internet of things, 3D visualization of factory
About the project error reporting solution of mpaas Pb access mode adapting to 64 bit CPU architecture
EasyCVR平台出现WebRTC协议视频播放不了是什么原因?
Behavior perception system