Circuit documentation
A practical reference for the workspace you are using. Circuit compiles and runs C on your device, with a local program library and an interactive terminal.
Getting started
Open the compiler. A fresh workspace starts with hello_world.c. Select New program, choose a name, and write C in the editor. Names use the .c extension. Press Run code or Ctrl/Cmd + Enter. The first run downloads compiler assets; later runs can use the browser’s cache.
Compiler messages appear in the terminal. If the build succeeds, the same terminal displays stdout and stderr from the running program. Exit status zero is shown as success; a nonzero status, a runtime failure, and a timeout have their own status messages. A successful status does not prove the result is logically correct.
For guided practice, open an example and select Try in Circuit. This adds a new saved copy, using a unique filename when needed. It does not replace an existing program or run the code automatically.
Program management
The sidebar lists your saved programs. Select one to open it in an editor tab. Search filters the library, and Recent programs helps find recently opened work. Closing a tab leaves its saved program in the library. Creating, renaming, duplicating, and deleting are separate actions in the program controls.
Edits save automatically. Check the save indicator: Saved locally confirms storage, while Not saved or Storage unavailable needs attention. Duplicate creates an independent copy. Rename changes the filename, not the code. Delete asks for confirmation and removes that saved program; there is no recycle bin.
Download saves the selected source as an individual .c file. Export all creates a JSON backup of the program library. Import accepts a Circuit backup and adds its programs without replacing matching names; name collisions receive a unique suffix. Layout preferences are separate from the program backup.
Local storage and backups
Circuit uses IndexedDB for programs and workspace state, plus local browser preferences for settings such as theme and terminal layout. No account or cloud synchronization is required. The library belongs to this browser profile and this site origin, including its scheme, hostname, and port.
Another browser, private browsing session, device, localhost port, or future custom domain has separate storage. Moving the website to a new domain does not automatically migrate your programs. Export before switching origins, then import on the new site. Clearing site data or browser eviction can remove the library; private-session data may disappear when that session ends.
There is no fixed promise of an unlimited program count. Available quota and device capacity vary. Keep external backups of important work. If storage fails, download or export the in-memory work before closing the page. Circuit cannot recover a deleted local library from an account server.
Code execution and input
Run sends the active source to a Web Worker inside your browser, not to a remote compiler API. The worker uses downloaded Clang/WebAssembly assets to compile and link the program, then executes it with a WASI runtime. Source and stdin remain local to this execution path. Requests for the website and compiler assets still reach the hosting service.
Interactive scanf and getchar
Type directly into the terminal after the program’s prompt. Enter submits a line to the active process and advances the cursor. Prompts without a newline share their line with your response. Focus remains in the terminal for later requests. getchar receives the characters in submitted lines, including their newline; this is line-oriented input, not a native raw-keypress shell.
Check scanf return values and avoid trailing whitespace in interactive format strings. For a character after a number, decide whether the leftover newline should be consumed or skipped. See printf and scanf for examples. User waiting time has a separate idle limit and does not count toward active execution time.
Stopping and switching files
Stop terminates the worker. Ctrl+C in the terminal also stops the process. Switching editor tabs does not turn another file into the running program: the terminal identifies the owner of the current run. You can edit another file while that run exists. Leaving the compiler page or reloading ends its worker session.
Supported C environment
The current toolchain is LLVM Clang distributed through YoWASP (package 22.0.0-git20542-10), targeting WebAssembly with WASI support. Circuit compiles with C17, -O0, -Wall, and -Wextra and links the standard C and math support used by this toolchain. It is not a native GCC server.
| Resource | Limit / behavior |
|---|---|
| Source | 100,000 UTF-8 bytes; one source program |
| Active execution | 3 seconds of active elapsed time, excluding waits reported by stdin |
| Waiting for input | 60 seconds idle |
| Overall session | 5 minutes |
| Compilation | 60 seconds after toolchain loading |
| Initial asset loading | 120 seconds |
| Input | 16,000 UTF-8 bytes total per run; submitted in lines |
| Output | 64 KiB each for stdout and stderr |
| Generated program memory | 128 MiB maximum linear memory, including a 1 MiB stack |
| Runtime files | In-memory directory, discarded after the run |
Limits are protective ceilings, not guaranteed available resources. The compiler itself also uses memory, and a constrained device can fail earlier. The active timer measures elapsed active execution, not operating-system CPU accounting. A busy loop is stopped; a blocked stdin read gets the separate human-input allowance.
Standard printf, scanf, getchar, arrays, functions, pointers, structures, and basic file streams are supported. Native GUI APIs, arbitrary host filesystem access, process launching, networking, and third-party native libraries are not provided. Files created by fopen exist only inside that execution’s memory. They do not persist with your saved .c source.
A modern browser needs WebAssembly, Web Workers, SharedArrayBuffer, and cross-origin isolation. The static site supplies the required isolation headers. Some invalid memory operations become WebAssembly traps, but not all C undefined behavior is detectable. Circuit has no full debugger, sanitizer interface, package installer, or multi-file project build UI.
Workspace and shortcuts
The editor supports syntax highlighting, indentation, bracket completion, and per-tab cursor positions. The terminal can be resized with its divider, hidden, and reopened. On narrow workspaces it moves below the editor. Theme and terminal preferences are remembered locally.
- Ctrl/Cmd + Enter: run the active program.
- Ctrl/Cmd + S: save.
- Shift + Alt + F: format the active C document with Clang Format. Also available in Program actions and the command palette; Ctrl/Cmd + Z undoes formatting.
- Ctrl/Cmd + P: find a program.
- Ctrl/Cmd + Shift + P: command palette.
- Ctrl/Cmd + W: close the current editor tab.
- Ctrl + Tab: cycle editor tabs; Ctrl/Cmd + 1–9: select a tab.
- Ctrl/Cmd + B: toggle the sidebar.
- Ctrl+C in the terminal: stop execution.
Browser and operating-system shortcuts may take precedence in some environments. The visible controls provide alternatives.
Troubleshooting
The compiler reports errors
Read the first diagnostic and the surrounding source, including the previous line. Check missing punctuation, undeclared identifiers, and mismatched format arguments. See the compiler error guide. An unavailable platform header may require a different environment rather than a syntax change.
The program waits or repeats a prompt
Click the terminal and enter the requested value. Check the scanf return count; failed conversions can leave bad text unread. A trailing newline in the format may wait for another non-whitespace character. Enter sends a complete line, not a native terminal key event.
A run fails or times out
Use Stop for an infinite loop. Check loop progress, indexes, division by zero, recursion depth, and allocation results. A 60-second input idle timeout or five-minute session limit ends an abandoned run even when it is not computing. Reduce excessive output instead of printing every iteration.
Compiler assets cannot load
There is no remote compiler service to restart. Check your connection, reload, and allow the site’s asset requests. An unsupported browser or missing cross-origin isolation prevents interactive execution. If a private or restricted browser blocks required features, try a supported standard browser session. Export important work before clearing any site data.
Programs are missing
Confirm that you are using the same browser profile and exact site address. Import your exported backup if you changed origins or cleared storage. If the problem continues, contact support with your browser, operating system, error text, and a minimal non-sensitive reproduction.