Answer's Question about pointer
When you create a new pointer, this will be in heap until you delete it.
So what you said is sort of mistake, "函数内部有个局部变量指针", then the pointer should not exist after the function return.
Therefore, you should delete the pointer before the program is done, or memory leak
int* add(){
int a =1;
int *Ptr=&a;
return Ptr; //for this Ptr is not actual local variable, because it be return, so other can use it
}
int add(){
int a =1;
int *Ptr=&a;
delete Ptr;
return 0; //for this Ptr is local variable, because it was deleted
}
Answer's Question about pointer的更多相关文章
- Stack-overflow, how to answer
How to Answer Welcome to Stack Overflow! Thanks for taking the time to contribute an answer. It's be ...
- HOW TO ANSWER: Tell Me About Yourself
https://biginterview.com/blog/2011/09/tell-me-about-yourself.html There are some job interview quest ...
- Question: Database Of Tumor Suppressors And/Or Oncogenes
https://www.biostars.org/p/15890/ 71 5.9 years ago by Malachi Griffith ♦16k Washington Univers ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) F2. Wrong Answer on test 233 (Hard Version) dp 数学
F2. Wrong Answer on test 233 (Hard Version) Your program fails again. This time it gets "Wrong ...
- Learning Conditioned Graph Structures for Interpretable Visual Question Answering
Learning Conditioned Graph Structures for Interpretable Visual Question Answering 2019-05-29 00:29:4 ...
- DrQA 阅读维基百科来回答开放问题 Reading Wikipedia to Answer Open-Domain Questions
DrQA 是一个阅读理解系统用在开放领域问答.特别的,DrQA 针对一个机器阅读任务.在这个列表里,我们为一个潜在非常大的预料库中搜索一个问题的答案.所以,这个系统必须结合文本检索和机器文本理解. 项 ...
- RFID 读写器 Reader Writer Cloner
RFID读写器的工作原理 RFID的数据采集以读写器为主导,RFID读写器是一种通过无线通信,实现对标签识别和内存数据的读出和写入操作的装置. 读写器又称为阅读器或读头(Reader).查询器(Int ...
- DTrace to Troubleshoot Java Native Memory Problems
How to Use DTrace to Troubleshoot Java Native Memory Problems on Oracle Solaris 11 Hands-On Labs of ...
- DC靶机1-9合集
DC1 文章前提概述 本文介绍DC-1靶机的渗透测试流程 涉及知识点(比较基础): nmap扫描网段端口服务 msf的漏洞搜索 drupal7的命令执行利用 netcat反向shell mysql的基 ...
随机推荐
- 重置windows用户漫游配置文件
1.备份用户数据 2.删除或修改漫游配置文件 3.用户PC管理员登陆,删除本地用户缓存文件 注册表打开: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows N ...
- Web安全XSS、CSRF和SQL注入
SQL注入 SQL注入是以用户的输入作为sql语句的一部分,如后端接收到用户的请求数据后,不经过数据转义,就把数据拼接到SQL中执行,容易导致SQL的语义被篡改,即受到攻击了. 解决办法是对接收的数据 ...
- sklearn 快速入门教程
1. 获取数据 1.1 导入sklearn数据集 sklearn中包含了大量的优质的数据集,在你学习机器学习的过程中,你可以通过使用这些数据集实现出不同的模型,从而提高你的动手实践能力,同时这个过程也 ...
- python基础学习笔记——列表技巧
列表: 循环删除列表中的每⼀个元素 li = [, , , ] for e in li: li.remove(e) print(li) 结果: [, ] 分析原因: for的运⾏过程. 会有⼀个指针来 ...
- 本机机器ssh docker容器
https://blog.csdn.net/u010324465/article/details/77184506 1.在docker中安装openssh-server 2.sudo /etc/ini ...
- Absolute(绝对定位)与relative(相对定位)的图文讲解
Position的属性值有:1. Absolute:绝对定位,是相对于最近的且不是static定位的父元素来定位 2. Fixed:绝对定位,是相对于浏览器窗口来定位的,是固定的,不会 ...
- 2011 Michigan Invitational Programming Contest
Crossings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463 Description ...
- POJ——1364King(差分约束SPFA判负环+前向星)
King Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11946 Accepted: 4365 Description ...
- 【NOIP2014】伤感·伤感·伤感
Day <0 虽说初三的时候考过一次提高组,而且还考得不错,但自己还是挺看重这次NOIP的[你想想旁边两大神级别人物在死命刷题,蒟蒻怎敢颓废]于是切完所有复赛题后又做了好多好多次模拟赛,状态自己 ...
- FZU 2020 :组合 【lucas】
Problem Description 给出组合数C(n,m), 表示从n个元素中选出m个元素的方案数.例如C(5,2) = 10, C(4,2) = 6.可是当n,m比较大的时候,C(n,m)很大! ...