C code

Press Ctrl/Cmd + Enter to run. Auto-run reruns 700 ms after editing. Enable Monaco for highlighting; it loads from a CDN only when requested.

The browsercc 0.1.1 Clang/LLD toolchain downloads from jsDelivr on the first Run — roughly 26 MiB compressed for clang.wasm, lld.wasm and the sysroot. Code is compiled to WebAssembly, then run in a fresh Worker. Prepare standard input before Run; there is no live terminal. C++ exceptions and threads are unavailable in this WASI toolchain. Runtime notices.

Code examples (20)

Click an example to replace the editor with a complete program. Auto-run is paused; press Run to compile and execute it.

Basics

Number exercises

Logic exercises

Arrays and search

Functions and OOP

Star patterns

Plain editor
0 lines · 0 chars

Output

Read the prepared input with scanf or fgets. Runs in a Web Worker, without direct DOM access. Stop terminates execution; each run has a 30-second execution limit and output is capped at 500 rows. Code can still make network requests, so only run code you trust. The tool does not save or upload your code or input.

Learn

C Playground Guide

About this tool

Compile C to WebAssembly in a disposable browser Worker with the browsercc 0.1.1 Clang/LLD toolchain. The compiler and sysroot download from jsDelivr only on Run or when Auto-run is enabled. Exercises cover arithmetic, logic, arrays, functions, structs and pyramid patterns. Code and input are not saved or uploaded by the tool. Compiled code can still make network requests through WASI; only run code you trust.

Questions

How do I read input?
Fill Standard input before Run, one answer per line, then call fgets or scanf. fgets keeps the trailing newline, so strip it before printing. Missing input returns NULL from fgets. This is prepared input, not a live terminal.
Why does the first Run take longer?
The Clang compiler, linker and sysroot download from jsDelivr on the first Run — roughly 26 MiB compressed. Runtime loading has a 90-second timeout, followed by a separate 30-second execution limit. Later Runs in the same page reuse the loaded toolchain.
Can I use exceptions, threads, fork or sockets?
This is a WASI build of Clang, not a desktop toolchain. Exceptions are unavailable in C, and threads, fork, and native OS processes are not supported. The standard C library works for console programs.
Does selecting an example erase my code?
Yes. C examples are complete programs with their own main, so clicking one replaces the editor and pauses Auto-run. Copy anything you want to keep first.
Is this a security sandbox?
No. A Worker prevents direct DOM access and can be terminated, but compiled code can make network requests through WASI. The tool itself does not upload or persist code or input. Each Run starts fresh; output is limited to 500 rows.