This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | Next revision Both sides next revision | ||
|
cpp:stack_unwinding [2021/05/25 07:56] gthanos |
cpp:stack_unwinding [2021/05/25 07:57] gthanos old revision restored (2020/05/04 13:34) |
||
|---|---|---|---|
| Line 7: | Line 7: | ||
| #include < | #include < | ||
| using namespace std; | using namespace std; | ||
| + | |||
| + | class Vector { | ||
| + | int *array; | ||
| + | int size; | ||
| + | | ||
| + | public: | ||
| + | Vector(int length=0); | ||
| + | ~Vector(); | ||
| + | }; | ||
| + | |||
| + | Vector:: | ||
| + | cout << " | ||
| + | size = length; | ||
| + | array = new (nothrow) int[size]; | ||
| + | if(array==NULL) { | ||
| + | cerr << " | ||
| + | exit(-1); | ||
| + | } | ||
| + | for(int i=0; i<size; i++) | ||
| + | array[i] = 0; | ||
| + | } | ||
| + | |||
| + | Vector:: | ||
| + | cout << " | ||
| + | delete [] array; | ||
| + | } | ||
| + | |||
| // called by FFF() | // called by FFF() | ||