online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// thread example #include <iostream> // std::cout #include <thread> // std::thread class classC { public: int test =10; }; class classA { public: void functionA(std::shared_ptr<classC> hh) { for (int i =0; i< 10; i++){ std::cout<<i<<hh->test<<std::endl; } } }; class classB { public: void functionB(std::shared_ptr<classC> hhh) { for (int i =0; i< 10; i++){ std::cout<<i<<hhh->test<<std::endl; } } }; int main() { std::shared_ptr<classC> c = std::make_shared<classC>(); classB* b; classA* a; b->functionB(c); a->functionA(c); std::thread first (b->functionB,c); std::thread second (a->functionA,c); // synchronize threads: first.join(); second.join(); std::cout << "A and B completed.\n"; 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