You can skip this section , if you do not want to install compiler in your computer.

# Compilation and run Make computer understood English

Type the following program into a standard text editor (vi or emacs on UNIX, Notepad on Windows or TeachText on a Macintosh). Then save the program to a file named hello.c. If you leave off .c, you will probably get some sort of error when you compile it, so make sure you remember the .c. Also, make sure that your editor does not automatically append some extra characters (such as .txt) to the name of the file. Here's the first program

#include <stdio.h>

int main()
    printf("Hello World  \n");

    return 0;

When executed, this program instructs the computer to print out the line “Hello World ” – then the program quits. You can’t get much simpler than that!

To compile this code on a Linux machine, type

g cc hello . c −o hello

This line invokes the C compiler called gcc, asks it to compile samp.c and asks it to place the executable file it creates under the name samp. To run the program, type

. / hello

You should see the output “Hello World ” when you run the program.

If you mistype the program, it either will not compile or it will not run. If the program does not compile or does not run correctly, edit it again and see where you went wrong in your typing. Fix the error and try again.

(adsbygoogle = window.adsbygoogle || []).push({});