pathologydemo1.cpp
来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架>」· C++ 代码 · 共 26 行
CPP
26 行
#include <iostream>using namespace std;int main() { int* jp = new int(13); /* allocate and initialize */ cout << jp << '\t' << *jp << endl; delete jp; delete jp; /* error: pointer already deleted */ jp = new int(3); /* Reassign the pointer, memory leak. */ cout << jp << '\t' << *jp << endl; jp = new int(10); /* Reassign the pointer, memory leak. */ cout << jp << '\t' << *jp << endl; int* kp = new int(17); cout << kp << '\t' << *kp << endl; return 0;}/*OUTOOP> g++ pathologydemo1.cppOOP> ./a.out0x8049e08 130x8049e08 30x8049e08 10Segmentation faultOOP>*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?