How to compile and run C program in Fedora?


Need tutorial about compile and run a C program in Fedora OS? Are you searching for a software to practice C program in Fedora? Here I have given a tutorial to run and compile a C program in Fedora operating system. Read the article to know more about it.

C programming in Fedora - Fedora is Linux based operating system and it does not need a special software to write and compile coding. For editor, you can use Gedit or VI editor which will available by default in Fedora. I recommend beginners to use Gedit editor to write codings. 

Tools required to compile C program in Fedora:


To compile C program in Fedora you need to install GCC compiler. Latest versions of Fedora will have GCC compiler by default. To install GCC compiler use following command in Terminal.

#yum install gcc gcc-c++

If you use Fedora fully for programming then try installing following package.

#yum groupinstall "Development tools"

Development tools has many developing related packages. This package will be updated regularly and so I don't have the exact list of packages. 

Compile and run steps:


1. Open Gedit editor and write a sample C program. Save the program with .c extension. For example, if you are writing a Hello World program, then save as hello_world.c
2. Now the next step is compiling the C program that you have saved in the editor. Compiling is just the conversion of coding into machine language (ie)0's and 1's. Compiling is done using GCC or CC compiler through Terminal. 
4. To compile you need to know the path where you have saved the program. 
3. To compile use the following command.
How to compile and run C program in Fedora?

C programming in Fedora - Fedora is Linux based operating system and it does not need a special software to write and compile coding. For editor, you can use Gedit or VI editor which will available by default in Fedora. I recommend beginners to use Gedit editor to write codings.

Tools required to compile C program in Fedora:


To compile C program in Fedora you need to install GCC compiler. Latest versions of Fedora will have GCC compiler by default. To install GCC compiler use following command in Terminal.

#yum install gcc gcc-c++

If you use Fedora fully for programming then try installing following package.

#yum groupinstall "Development tools"

Development tools has many developing related packages. This package will be updated regularly and so I don't have the exact list of packages.

Compile and run steps:



C in Fedora
1. Open Gedit or VI editor and write a sample C program. Save the program with .c extension. For example, if you are writing a Hello World program, then save as hello_world.c. In to write program in VI editor use following command.
#vi Program_Name.c
2. Now the next step is compiling the C program that you have saved in the editor. Compiling is just the conversion of coding into machine language (ie)0's and 1's. Compiling is done using GCC or CC compiler through Terminal.
4. To compile you need to know the path where you have saved the program.
3. To compile use the following command.

#cc hello_world.c

After doing it, you will get a compiled file as a.out.
4. The final step is to run the program. To do so use following command.
#./a.out



#cc hello_world.c

After doing it, you will get a compiled file as a.out. 
4. The final step is to run the program. To do so use following command.
#./a.out

Read RHCE certification course, exam fee & salary in India


Comments



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: