1. Our First Program

Hello, World!

Our first program is called “Hello, World!”.  It has one purpose, to say hello to the world!

We get started by connecting to our Linux server.  Once logged in we will create a new file with vi called hello.c.  At the $ prompt type vi hello.c

$ vi hello.c

Once in vi type i to start insert mode and enter the following code:

#include <stdio.h><

int main(void){
     printf("Hello, World!\n");

After you have entered the code press the escape key, then type :wq (colon w q)

You should now be back at the shell prompt.  enter the following command:

cc hello.c

If there are no errors you program has successfully compiled and linked.

If there are errors, read the errors for clues as to why the program did not successfully compile.  

Once your program has successfully compiled, execute it by typing .\a.out at the shell prompt:

$ ./a.out