Hello, World!


The C programming language is a common-purpose programming language, which links closely to the way machines work. Understanding how computer memory works is an important feature of the C programming language. Although C can be examine as “hard to learn”, C is, in fact, a very easy language, with very strong capabilities.

C is a compiled language – which means that in order to run it, the compiler (for example, GCC or Visual Studio) must take the code that we wrote, process it, and then generate an executable file. This file can then be executed and will do what we deliberate for the program to do.

C is a very common language, and it is the language of many applications such as Windows, Git, and many many more.

Our first program

Every C program uses libraries, which give the capability to execute obligatory functions. For example, the most primary function called printf, which prints to the screen, is defined in the stdio.h header file.

To add the capability to run the printf command to our program, we should add the following include directive to our first line of the code:

#include <stdio.h>   

The second segment of the code is the definite code which we are going to write. The first code which will run will always reside in the mainfunction.

int main() {
  ... our code goes here

The int keyword designates that the function main will return an integer – a simple number. The number which will be returned by the function designates whether the program that we wrote worked accurately. If we want to say that our code was run successfully, we will return the number 0. A number greater than 0 will signify that the program that we wrote failed.

For this tutorial, we will return 0 to designate that our program was successful:

return 0;

Observe that every line in C must end with a semicolon, so that the compiler knows that a new line has begined.

Last but not least, we will need to call the function printf to publish our sentence.


Change the program at the bottom so that it prints to the output “Hello, World!”.