online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #include <assert.h> typedef unsigned char byte; typedef byte (*smbusCallback)(byte*); byte exampleCallback(byte* buff) { buff[0] = 1; return 1; } byte (* funMap [])(byte*) = { exampleCallback, NULL }; byte buffGlobal[50]; byte doCommand(byte command) { smbusCallback func = funMap[command]; if (func == NULL) { printf("callback was null with command %i\n", command); return 0; } else { printf("callback was a function with command %i\n", command); } return func(buffGlobal); } int main() { int len = -1; len = doCommand(0); assert (len == 1); assert (buffGlobal[0] == 1); len = doCommand(1); assert (len == 0); 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