Hello friends,
sometimes we need to run the C programs in the Linux Box,
Today i am showing you people how to run an "C language program" from the Linux System.
In linux we can use the gcc command to run C programs
Most of the time by default the gcc installed in the linux.
Type the following command to verify the gcc is installed :
which gcc
output
/usr/bin/gcc
To find the version of the gcc
gcc --verision
output
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Writing first program:
Open the vi editor
$vi Hello.c
and type the following lines of code
#include<stdio.h>
main (void)
{
printf("Hello World");
return 0;
}
Compiling Program
Compile the program and make executable
$gcc Hello.c -o Hello
To execute the program
$./Hello
Output
Hello World
sometimes we need to run the C programs in the Linux Box,
Today i am showing you people how to run an "C language program" from the Linux System.
In linux we can use the gcc command to run C programs
Most of the time by default the gcc installed in the linux.
Type the following command to verify the gcc is installed :
which gcc
output
/usr/bin/gcc
To find the version of the gcc
gcc --verision
output
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Writing first program:
Open the vi editor
$vi Hello.c
and type the following lines of code
#include<stdio.h>
main (void)
{
printf("Hello World");
return 0;
}
Compiling Program
Compile the program and make executable
$gcc Hello.c -o Hello
To execute the program
$./Hello
Output
Hello World
0 comments:
Post a Comment