Wednesday, June 17, 2015

C Programming Hello World

1. In terminal, enter the file name and edit it with nano:

nano test.c

2. Edit the file as below:

#include <stdio.h>

void main()
{
    printf("Hello World\n");
}



Exit and save the file.

3. Compile the file with the gcc command below:

gcc test.c -o test

There should be no warning message.

4. Run the file:

./test


The result should print out "Hello World".

No comments:

Post a Comment