online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdlib.h> #include <stdio.h> int *ptr = 0; int size; int currentIndex; void initialize () { if (ptr) return; size = 2; ptr = malloc (sizeof (int) * size); currentIndex = 0; } void unInitialize () { if (ptr) free (ptr); size = 0; currentIndex = 0; } void doubleTheSize () { ptr = realloc (ptr, sizeof (int) * size * 2); size = size * 2; } void AddElement (int element) { if (currentIndex >= size) doubleTheSize (); ptr[currentIndex] = element; ++currentIndex; } void printInput () { for (int i = 0; i < currentIndex; ++i) { printf ("%d ", ptr[i]); } printf ("\n"); } int main (void) { initialize (); int i = 0; do { printf ("Enter Element :"); scanf (" %d", &i); //condition to break the loop if (i == -1) break; AddElement (i); printInput (); } while (1); unInitialize (); 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