online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <functional> using namespace std; typedef int32_t (*callback_c_type) (std::string &, uint32_t); static int counter = 0; int32_t my_callback (std::string & index, uint32_t var_id) { std::cout << "my_callback => index: '" << index << " var_id: '" << var_id << "'" << " counter = " << counter << std::endl; counter++; return 42; } void execute_c_callback(callback_c_type cb) { std::cout << "execute_c_callback" << std::endl; std::string text = "foo"; cb(text, 777); } int main () { callback_c_type cb = &my_callback; execute_c_callback(cb); std::function <int32_t (std::string &, uint32_t)> cb_2 = cb; // execute_c_callback((callback_c_type)cb_2); // PROBLEM: convert std::function<int32_t(std::string&, uint32_t)> -> callback_c_type 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