Things You'll Need:
- C Compiler Text Editor
-
Step 1
Download and install a C compiler from The Free Country (see Resources).
-
Step 2
Open your text editor and save the file name as HelloWorld.c.
-
Step 3
Include the Standard Input/Output preprocessing directive at the start of the file. Preprocessing directives are indicated by the #include statement which causes the preprocessor component of the C compiler to replace this part of the file with the information included in the standard input/output library.
#include <stdio.h> -
Step 4
Call the function main which is used to start program execution in C. The main function returns an integer value and the void statement indicates that no data type are passed as information to the function.
int main (void)
{ -
Step 5
Next use the printf function to print the words "Hello World" to the computer console.
printf("Hello World");
return 0;
} -
Step 6
Compile the simple program by typing cl HelloWorld.c. This will create HelloWorld.exe that you can then run by double clicking the file name in your file manager and view the output "Hello World" on your console output.












