当前位置:网站首页>Error: error summary of pointer as function parameter
Error: error summary of pointer as function parameter
2022-06-11 17:01:00 【NI3E】
We know , The arguments passed by the function are “ Copy ”, It is not to pass in the original value , Unless the parameter is an array “ Address ”.
When you pass a pointer as a function parameter , Take it for granted that the pointer has been modified in the function , Keep pointer changes outside the function .
actually , After calling the function , The pointer does not change .
So you can point to the new pointer as the return value , Change the original pointer to by assignment . To modify the pointer .
2021-6-12 Add
In use C Write stack and list All the time .
Already know “ When a pointer is passed in as a function parameter , Modified the pointer in the function , The pointer outside the function does not change , You need to use the return value to change the original pointer to ”. But the last time I didn't write down the problems I really encountered .
When I want to change the chain structure , Adopted move Function calculates the next position allowed by the algorithm , Then proposed int Type stores the number of steps , But in fact, we need to ensure that the pointer always points to the desired position when the function is running (Head or tail), therefore , When nesting functions , We always need to ensure that the return value is a pointer , Can be in main The position of the pointer inside is normal . therefore move It calls the function to change the direction ,move The return value needs to be a pointer .
in other words , When it comes to the pointer problem of this linked list , Nested functions should satisfy that the return value is a pointer . And every call is “ The pointer = function ( The pointer )” In the form of , Every floor should be like this .
边栏推荐
- ^31 prototype interview questions
- RSP: An Empirical Study of remote sensing pre training
- 启牛推荐开通的股票账户安全吗?靠谱吗
- Song of the sea in 5g Era
- ^31原型面试题
- 虚拟局域网划分与虚拟局域网间路由(VLAN)
- 从0到1了解Prometheus
- 啟牛商學院給的證券賬戶是安全的嗎?開戶收費嗎
- Global and Chinese molten carbonate fuel cell industry outlook and market panoramic Research Report 2022-2028
- ^32执行上下文栈面试题
猜你喜欢

Solve the problem that jupyter cannot connect to the kernel based on pycharm and Anaconda -- solution 1
![[opencvsharp] spot detection barcode decoding image operation image rotation / flip / Zoom perspective transformation image display control demo notes](/img/a7/5b66ef0360ed41441653a413cd9e53.png)
[opencvsharp] spot detection barcode decoding image operation image rotation / flip / Zoom perspective transformation image display control demo notes

A set of ThinkPHP wechat applet mall source code with background management

ShellBrowser .NET Crack

Katalon Studio Enterprise

Why does chip design also need "Craftsmanship"?

一套ThinkPHP微信小程序商城源码带后台管理

2022 national question bank and mock examination for safety officer-b certificate

Docker安装mysql5.7(开启binlog功能、修改字符)

用实际案例分析PMP与ACP应该考哪个?哪个更有用?
随机推荐
seed-emulator下进行sql注入攻击(含sql环境配置)
cocoapod只更新指定库(不更新索引)
ASP. Net education OA system source code education industry OA system source code with document
golang中的异常处理和异常使用
Wechat applet timestamp conversion time format + time subtraction
ASP.NET教育OA系统源码 教育行业OA系统源码带文档
From a "trendsetter" to a "wind chaser", can master Kang still lead the market?
Cocoapod only updates the specified library (does not update the index)
Oracle analysis function over and MySQL achieve similar effects
Haas, which integrates relevant technologies of Alibaba cloud, Dharma Institute and pingtouge, has officially announced the book
2022 R1 quick opening pressure vessel operation test question bank and simulation test
LeetCode-859. 亲密字符串
从0到1了解Prometheus
Solr (II) Solr adds core and dependent package path
Weekly recommended short video: rookie CEO talks about the new logistics track in the future
Real time myth -- real-time RTOS multitask performance analysis
Learning C language from scratch day 039
接口的特点&&接口与抽象类的对比
^31原型面试题
Katalon Studio Enterprise