当前位置:网站首页>Analysis of the self increasing and self decreasing of C language function parameters

Analysis of the self increasing and self decreasing of C language function parameters

2022-07-04 22:51:00 hugo33

When looking at the code left by predecessors, I saw such a function :
 Insert picture description here
At that time, I was thinking about the value of this parameter after it was passed in ? A little confused , After reading this article, I can roughly understand :
https://blog.csdn.net/salman_tan/article/details/86168767

If formal parameter uiSendNoAck The initial value for the 0, Then after passing it in , When using this value , It should be the value before the variable increases , That is to say 0, But if the address of the variable is passed in , That is to say &uiSendNoAck, Then using this variable is the value after self increment , That is to say 1. We can understand that , After the formal parameter is passed in, a temporary variable will be generated , The value of the temporary variable is the value of the parameter when it is passed , After passing, the formal parameter will increase automatically . Therefore, using this value in the function is before self increment , Use the address of this variable , It is after self increase .

原网站

版权声明
本文为[hugo33]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207041956049548.html