online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #include <stdlib.h> #include <string.h> char *schiller= "Wer wagt es, Rittersmann oder Knapp,\n" "Zu tauchen in diesen Schlund ?\n" "Einen goldnen Becher werf ich hinab,\n" "Verschlungen schon hat ihn der schwarze Mund.\n" "Wer mir den Becher kann wieder zeigen,\n" "Er mag ihn behalten, er ist sein eigen."; char* line(FILE* f) { static char* s; if (f) { int c; char i; s = s ? *s = 0, s : calloc(1, 2); while ((c = fgetc(f)) != EOF && c != '\n') strncat(s = realloc(s, strlen(s) + 2), (i=c,&i), 1); return feof(f)&&!*s?0:s; } free(s); return s = 0; } int main() { char* s,*a=0; int i,w; FILE* f = fmemopen(schiller, strlen (schiller), "r"); while (s = line(f)) puts(s); rewind(f); scanf("%d", &w); for (i = 1; s = line(f); ++i) if (i == w) puts(strcpy(a = malloc(strlen(s) + 1), s)); fclose(f); line(0); free(a); 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