online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; void realloc1(int**data,const int size); int main() { int * old = new int [10]{1}; for(int i=0;i<10;i++) old[i]=i; for(int i=0;i<10;i++) cout<<old[i]<<' '; cout << "<-main" << endl; delete []old; int * newone = new int [20]{1}; old=newone; for(int i=0;i<20;i++) old[i]=i*2; for(int i=0;i<20;i++) cout<<old[i]<<' '; cout << "<-main!" << endl; realloc1(&old,15); for(int i=0;i<15;i++) cout<<old[i]<<' '; cout << "<-main realoc1!" << endl; delete [] old; return 0; } void realloc1(int**data,const int size) { delete []*data ; int * newone = new int [size]{}; for(int i=0;i<size;i++) newone[i]=i*3; *data=newone; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue