Skip to main content

Online C compiler

Visualize

See your code run, step by step

The fastest way to understand loops, recursion, lists and objects, and to find bugs.

  • The line that just ran and the line that runs next, highlighted in your code.
  • A plain-English note on every step: which variable changed, which function was called, what it returned.
  • The call stack as cards, so recursion is easy to follow: every call is numbered and shows its own variables.
  • Arrays as indexed boxes, structs with their fields and memory on the heap, with arrows from each pointer to what it points to.
  • When the code fails, the error explained in simple words, with a button to jump to the step where it happened.
  • Play, pause, go back and forward, or drag the slider. Works on phones too.
Open the C code visualizer

What it supports

C17 (GCC 14) in your browser

  • C with the standard library (stdio, string, math and more), compiled for you.
  • If something is wrong, the error tells you the line and what to fix in plain words.
  • Type what scanf reads in Input; what printf prints appears in Output.
  • Runs stop after 5 seconds, so a loop that never ends cannot freeze anything.
  • Your code stays in your browser. Nothing is kept on our servers.

Input

How to read input in C

Programs that read from the keyboard get their input from the Input box. Type one value per line, then press Run. The program reads the lines in order, just as it would from a keyboard.

int n;
scanf("%d", &n);                 // first number
char word[100];
scanf("%99s", word);             // next word
char line[256];
fgets(line, sizeof line, stdin); // rest of the line

Questions

Frequently asked questions

Do I need to install a C compiler to use this?
No. Your code is compiled with GCC (C17) and run on our servers, so a browser on a laptop or a phone is enough. Later, install GCC or Clang on your computer for bigger projects.
How do I read input in C here?
Type the input in the Input box, one value per line, and read it with scanf or fgets. The whole box is given to your program as standard input when you press Run.
What does "Segmentation fault" mean?
The program read or wrote memory it does not own: a NULL or uninitialised pointer, an array index out of range, or recursion that never stops. Press Visualize to see the exact line and the values just before it happened.

Learn

Learn C step by step

Press Visualize on any program to watch it run line by line: the fastest way to understand loops, functions and objects.