![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
oo校长
技术拓荒~
展开
-
const的常见用法
const用法主要是防止定义的对象再次被修改,定义对象变量时要初始化变量 下面我就介绍一下几种常见的用法1.用于定义常量变量,这样这个变量在后面就不可以再被修改 const int Val = 10; //Val = 20; //错误,不可被修改 2. 保护传参时参数不被修改,如果使用引用传递参数或按地址传递参数给一个函数,在这个函数里这转载 2013-01-11 22:20:30 · 282 阅读 · 0 评论 -
const char **ptr 与 char *ptr[] 的释放问题的探究
先上代码,以便于分析#include <iostream>#include <string>#include <string.h>#include <stdlib.h>#include <stdio.h>using namespace std;int main(){ char *data[] = {NULL}; const char **ptr = (const char*原创 2016-05-20 19:58:37 · 2693 阅读 · 0 评论