当前位置:网站首页>Function (error prone)

Function (error prone)

2022-07-05 04:18:00 Cao Lele loves learning

Function passing array , When the pointer , It's just the starting address .

example :1 Sum of dimension groups

  Find out , Find the size of the array , be equal to 2? instead of 5?

Explain it. 2 How did you get it : Because mine is 64 It's a plane , and sizeof(int) Everybody knows ,4 byte ,32 position ; therefore sizeof(p), It should be 64; Why 64? Because I said the first sentence : Function passing array , When the pointer , What is passed is only an address ,64 Address of bit machine , No, it is. 64bit Well .

therefore , To make an array ( The pointer ) Size , It should also be passed to the function in the form of formal parameters .

--------------------------------------------------------------------------------------------------------------------

A character array , Because there is at the end '\0', So sometimes it is not necessary to pass the array size when passing parameters

example : Remove spaces from string

原网站

版权声明
本文为[Cao Lele loves learning]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050416449638.html