| 9 | arr= new int[ms]; |
| 10 | } |
| 11 | void push_back(int d){ |
| 12 | if(cs==ms){ |
| 13 | int *oldArr=arr; |
| 14 | ms*=2; |
| 15 | arr= new int[ms]; |
| 16 | //copy the old items to the new array of double size |
| 17 | for (int i = 0; i < cs; i++) { |
| 18 | arr[i]=oldArr[i]; |
| 19 | } |
| 20 | delete []oldArr; |
| 21 | } |
| 22 | arr[cs]=d; |
| 23 | cs++; |
| 24 | } |
| 25 | void pop_back(){ |
| 26 | if(cs>=0){ |
| 27 | cs--; |
no outgoing calls