Categories
C Language Linux Server

How to see output of C program in Linux or UNIX

How to compile a c program and see the output of C program in Linux. This simple steps will guide you to use the linux commands to generate the output of C program.

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

By Vaseem Ansari

Hey guys this is Vaseem Ansari, 27 years old, Software & Web Developer, Blogger & works on Wordpress Plugin Themes Development, PHP MySql Programming and Open Sources Technologies.
It takes a while for me to build trust in someone new. I am honest, thoughtful. I'm Glad I'm Me No one looks The way I do. No one walks the way I walk. No one talks the way I talk. I am me. There's no one else I'd rather be! Have fun reading this blog and don't forget to subscribe to the feed to keep updated on the latest articles.

Leave a Reply

Your email address will not be published. Required fields are marked *