online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #define IN 1 /* inside a word */ #define OUT 0 /* outside a word */ /* counts lines, words and characters as input */ int main() { int c, nl, nw, nc, state; state = OUT; /* set these three constants to 0: */ nl = nw = nc = 0; while ((c = getchar()) != EOF){ ++nc; if (c == '\n') ++nl; /* || == OR (&& == AND) evaluation of the following line will stop as soon as the truth or falsehood is known, so the order matters */ if (c == ' ' || c == '\n' == c == '\t') state = OUT; else if (state == OUT){ state = IN; ++nw; } } printf("%d %d %d\n", nl, nw, nc); }

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