online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <string.h> int scanf_solo_int(int *p) { // read integer int ret = scanf("%d", p); if(ret == EOF) return -1; // read rest of line char s[132 + 1]; if(scanf("%132[^\n]", s) != 1) s[0] = '\0'; scanf("%*1[\n]"); if(ret == 1) { // check for extra non-whitespace if(s[strspn(s, " \t\n")] != '\0') ret = 2; } return ret; } int main() { for(;;) { int n; switch(scanf_solo_int(&n)) { case 1: printf("ok: %d\n", n); continue; case 0: printf("error: not a number\n"); continue; case 2: printf("error: extra characters past %d\n", n); continue; case -1: printf("error: EOF\n"); break; default: printf("error: unexpected\n"); break; } break; } 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