online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #include <stdbool.h> #include <ctype.h> #define TITLE_MAX 50 void mygets(char buffer[], size_t limit) { // first non-space char until newline or EOF, // eating any extra chars in buffer // will add \0 at the end, so will get up to N-1 chars int c, idx=0; bool started=false; while ((c=getchar()) != EOF && c != '\n') { if (!started && isspace(c)); if (idx < limit-1) { started = true; buffer[idx++] = c; } } buffer[idx] = '\0'; } int main(void) { char tbuffer[TITLE_MAX]; while (true) { printf("Enter the name of the film (empty line to stop)\n"); mygets(tbuffer, TITLE_MAX); if (*tbuffer=='\0') break; printf("The title is: %s\n", tbuffer); } }

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