online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> struct Mystruct { int a, b; }; //the function return a Mystruct object by value Mystruct sum_struct(const Mystruct *x, const Mystruct *y) { Mystruct ret{0,0}; ret.a = x->a + y->a; ret.b = x->b + y->b; std::cout << ret.a << "--" << ret.b << "--\n"; //Shows 6--7-- return ret; //return ret by value } int main() { Mystruct o, p, q; //note q is not a pointer now p.a = 1; p.b = 2; o.a = 5; o.b = 5; q = sum_struct(&o, &p); std::cout << q.a << "--" << q.b << "--\n"; // shows 6--7-- }

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