Origin


Resu, North Garo Hills, Meghalaya 794108

Monday 12 May 2014

Running your first "Hello World" C program in the Terminal

First check if you already have GCC (GNU Compiler Collection) installed in your system. Type # gcc --version (or # which gcc). If not, install it first: # yum install gcc or # yum install gcc-c++

Next open a text editor (GEDIT, say) and write your first C program.

# gedit hello.c

The hello.c program's source code can be something like

#include <stdio.h>

int main()

{
printf("Hello World");
return 0;
}

Next compile  and create an executable file

# gcc hello.c -o hello

Now execute your program

# ./hello

No comments:

Post a Comment