## Writing and running a "Hello, World" program in C

This tutorial explains how to create and run a simple program in the C programming language (using the tcc C compiler) on MontaukOS.

1. Open the Text Editor by navigating to the 'Applications' section in the app menu.

> Did you know? The MontaukOS Text Editor provides syntax highlighting for C and Lua files.

2. Type:

   >     #include <stdio.h>

   >     int main(void) {
   >         printf("Hello, World!\n");
   >         return 0;
   >     }

   into the Text Editor window. This code outputs the string "Hello, World!" along with a line break to the Terminal.

3. Click the Save (floppy disk) button on the top panel. Choose a directory to save your code in - for example, your Home folder - give the source file a name ending in .c, and click 'Save'.
4. Open the Terminal app by navigating to the 'Applications' section in the app menu. You should see something like this appear on your screen:

   >         MontaukOS
   >         Copyright (c) 2025-2026 Montauk Operating System Project

   >         Logged in as admin

   >         Type 'help' for available commands.

   >     0:/users/admin>

5. If you saved your program's source file somewhere other than your Home directory, switch to the directory in which you saved your program using the cd command. For example, `cd Documents`.
6. Type '`tcc` ' followed by your program's name, and then press enter. For example, '`tcc hello.c`'.
7. Run your program by typing its name without the '.c' extension, before pressing enter - for example, "hello".
8. You should see "Hello, World!" displayed in the Terminal window. Congratulations!

Back to Documentation Index