online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <assert.h> #define LEN(x) (sizeof(x)/sizeof(*x)) #define NUM 0 int sum(int array[], int *end) { assert(array && end && array < end); int result = 0; for (; array != end; array++) result += *array; return result; } int* find(int array[], int *end, int value) { assert(array && end && array < end); for (; array != end; array++) if (*array == value) return array; return NULL; } int main() { int a[] = { 7, 0, 3, 2, 5, 0, -7, 4 }; int *first = find(a, a + LEN(a), NUM) + 1, *last = find(first, a + LEN(a), NUM), result = sum(first, last); printf("%d", result); 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