online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; class X { private: int* p_; public: X() : p_(new int) { cout << "Default constructor" << endl; } ~X() { cout << "Destructor" << endl; int* q=p_; p_ = nullptr; delete p_; } X(const X& other) { cout<<"copy constructor"<<endl; }; X& operator = (const X& other) { cout <<"assignment operator"<<endl; return *this; } }; void doNothing(X x) { // line 30 (when the function is entered) cout<< " Line 31 After "<<endl; cout << "I do nothing!"<<endl; return; // line 33 (when the function exits) } int main() { cout<< " Line 38 Before "<<endl; X* a = new X(); // line 3 cout<< " Line 38 After "<<endl; X b; // line 40 cout<< " Line 40 After "<<endl; b = *a; // line 42 cout<< " Line 42 After "<<endl; doNothing(b); cout<< " Line 46 Before "<<endl; delete a; // line 46 cout<< " Line 46 After "<<endl; return 0; }

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