valgrind-test.cpp.svn-base
来自「QT方面的开发」· SVN-BASE 代码 · 共 21 行
SVN-BASE
21 行
/** This program contains some examples of memory leaks and other bad programming practices. */#include <iostream>int badpointer2(int k) { int* ip = new int[3]; ip[0] = k; return ip[3]; /* out of bounds index */} /* memory leak */int main() { using namespace std; int* iptr; int num(4), k; /* k is uninitialized */ /* what is the state of iptr? */ cout << iptr[num-1] << endl; cout << badpointer2(k) << endl;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?