< Language Tutorials

Here are some instructions on how to make a program in the C programming language that would say "Hello World!".

Prerequisites

A text or code editor or an Integrated Development Environment (IDE in short) is required to write this program. There are many options available online.

Note Warning: Be careful when downloading programs from the internet; make sure to ask your parent or guardian first and download compressed files. If you just want to see how this works then use an online IDE.

Scratch Code

If you were making this with Scratch, you would code it like this:

when gf clicked
say [Hello World!]

C Code

The C code for this very similar to the Scratch code shown above. But there are some things you have not seen in Scratch which are needed for this program. They are #include <~insert library name here~> , int main void and printf ("~enter what you want the program to say here~"). Among these the first two are needed for every single C program, whereas printf is only needed when you want your program to say something.

Now, the C code is-

#include <stdio.h>

int main(void) 
{
  printf("Hello World!");
}