Categories
C Language Linux Server

How to see output of C program in Linux or UNIX

As like most of the programmer i am new to Linux and i read c programming in college days. At college we used Turbo C compiler under DOS/Windows XP to write and compile C programs.
But in Linux we don’t have that compiler. So today i will tell you simple steps to generate the output of c program in Linux.
First create a simple c program called test.c.

In Linux there is a command gcc (GNU project C and C++ compiler) to compile a program. When you compile a program it generates an executable file called a.out.

Syntax
gcc -o output-file program.c
The above code will create a compile file of the c program.
Suppose your program name is mytest.c
then the command will be
gcc -o mycompilefile mytest.c

Now if you want to to compile the file on linux server then type the command:
gcc mytest.c

If you want to Execute the c program to see the output of tht c program mytest.c
./mycompilefile