C语言趣事之内存泄露
来源:互联网 发布:那些年的经典网络歌曲 编辑:程序博客网 时间:2024/05/22 07:02
C语言定义变量,分配内存时采用的是栈模式,于是乎,就有了如此如此,这般这般的效果
#include<iostream>using namespace std;int main(){int a = 66666;int b = 22222;int c[2] = {333333,44444};cout << " 修改前的值 " << endl;cout << " c[2]= " << c[2] << endl;cout << " c[3]= " << c[3] << endl;c[3] = 12345; //修改c[3]的值 cout << "修改后的值:" <<endl;cout << " c[3]= "<< c[3] << endl;cout << " a= "<< a << endl; return 0;}
同理,我们可以利用指针这种东西,如下
#include<iostream>using namespace std;int main(){int a = 0;int *p = &a;for(int i=0;i<10;i++){cout << p << " : ";cout << *p++ << endl;}return 0;}
- C语言趣事之内存泄露
- 常见C错误之内存泄露
- C语言之内存使用
- C语言之内存操作
- C语言之内存管理
- C语言之内存对齐
- C语言之内存管理
- C语言之内存操作
- C语言之内存管理
- C语言之内存管理
- C语言之内存对齐
- c语言之内存扫描
- c语言之内存使用
- C语言之内存对齐
- C语言之内存对齐
- c语言之内存管理
- C语言之内存图
- C语言之内存管理
- CELayoutEditor中控件上中文的显示
- 【java】JSON for java入门总结
- 哈夫曼编码
- Linux性能监测:内存篇
- Android 使用摄像头。
- C语言趣事之内存泄露
- Hibernate 中 formula的简单应用
- NET Framework 4 中的新增功能
- MoreEffictiveC++读书笔记
- heap corruption detected ,释放内存时出错
- DisplayMetrics
- ADO.NET操纵Excel 标点符号 数字和字符混合问题! HDR=Yes;IMEX=1
- pda hvga vga
- select样式