Skip to content

C Online Compiler

Write C, give it input and run it with GCC in seconds, right in your browser.

main.c
Open in K-Programmer ↗ Free course Ctrl+Enter runs · Tab indents · Esc then Tab leaves the editor
Output
 

Runs on K-Programmer's sandboxed compiler (GCC 14, C17): 5 s time limit, 512 MB memory, no network.

Report a problem

Don't include personal or sensitive information.

What happened, and what did you expect? (10–2000 characters) 0 / 2000

Your browser and system, screen size and recent error messages on this page. Never what you typed or your files. Privacy

What is sent
 

This online C compiler compiles your program with GCC 14 (C17 standard, -O2, math library linked) and runs it in a locked-down sandbox on the K-Programmer engine. You see exactly what a real terminal shows: printf output, runtime errors, the exit code and compiler error messages with line numbers.

Type what your program reads with scanf, getchar or fgets in the Input box before you click Run. Start from a sample (hello world, input, loops, arrays, functions, bubble sort with binary search), keep your work automatically saved in your browser, and share any program with a link.

How to use the C Online Compiler tool

  1. Pick a sample program or write your own C code in the editor.
  2. Type the program's input in the Input box, for example Dara 20 for scanf("%s %d", ...).
  3. Click Run or press Ctrl+Enter.
  4. Read the output, errors and run time below the editor; fix and run again.
  5. Click Share code to copy a link, or Open in K-Programmer to keep learning there.

Why use ToolOrca C Online Compiler

  • Real GCC 14 compiler with the C17 standard and <math.h>
  • Standard input for scanf, getchar and fgets
  • Compiler errors and warnings with line numbers
  • Syntax highlighting, line numbers, auto-indent and Ctrl+Enter to run
  • Six sample programs, from hello world to sorting and searching
  • Autosave in your browser and share links with the code inside

How input works in the C compiler

Online compilers cannot stop and wait while you type, so you give all input before you click Run. Everything in the Input box is sent to your program as standard input, exactly like typing it in a terminal and pressing Enter. scanf("%d %d", &a, &b) reads two numbers whether they are on one line or two.

Prompts such as printf("Enter your age: ") are still printed, but the typed answer does not appear after them because it comes from the Input box. If your program waits for more input than you gave, scanf returns EOF; check its return value as the samples do.

Compiler settings and limits

Programs are compiled with gcc -O2 -std=c17 main.c -lm. Each run gets 5 seconds of run time, 512 MB of memory and no network access, in a fresh sandbox that is deleted afterwards. Files can be created in the temporary folder during the run, but nothing is kept.

Common errors: Time limit exceeded usually means an endless loop or a while (scanf(...)) loop that never ends; Runtime error (exit code -11) with “Segmentation fault” is a crash, typically an array index out of range or a bad pointer.

Learning C step by step

The samples follow the order most C courses use: output with printf, reading input, for and while loops, arrays, functions and recursion, then a classic algorithm. Change one thing at a time and run again to see what it does.

For lessons, exercises with automatic grading and contests in English and Khmer, open the code in K-Programmer.

Frequently asked questions

Which C compiler is used?

GCC 14 with -std=c17 -O2 and the math library (-lm), running on Linux.

How do I give input to scanf?

Type it in the Input box before you click Run, the same way you would type it in a terminal. Separate values with spaces or new lines.

Can I use conio.h or graphics.h?

No. Those headers are from old Turbo C on DOS and are not part of standard C. Use stdio.h, stdlib.h, string.h, math.h and the other standard headers.

How do I share my code?

Click Share code. The link that is copied contains your code and input, compressed, after the # sign, so nothing is stored on a server and the link works as long as you keep it.

What is "Open in K-Programmer"?

K-Programmer is a free platform for learning to code, with lessons, quizzes, contests and the same online compiler. The button copies your code and opens K-Programmer, where you choose the language, paste the code and keep working (sign in to save programs).