How to program in c from linux
Table of contents:
If you are starting out in the fabulous world of programming and you use Ubuntu (a good environment for programming), today we want to tell you how to program in C from Linux. You will surely ask yourself this question at first, because you may be very lost and find absolutely no confidence. In today's article, we are going to tell you a trick that will come in handy to compile and run C programs on Linux.
How to program in C from Linux
These are the steps you have to follow:
The first thing is to install the build packages. To do this, open a console and run the following command with permissions (it will ask for your password, it's yours for Ubuntu):
- sudo apt-get install build-essential
Once everything is installed, you have the environment ready to compile your projects.
- Create a plain text file but save it with the extension " .c ". Now, in terminal, run:
- gcc program.c -o program (compiles the file program.c we call it "program") ./program (runs the program).
In order for your C program to do something, you will have to add the necessary code.
It starts with the classic "Hello World"
One of the most suitable codes to start in any programming language is Hello World . You just have to open a text file and copy and paste the following text.
#include You can save it as “ holamundo.c “. Then, you compile and run it as we told you above and it should work for you. Since it has a printf, all it does is display the hello world text string (on the console) and then leave a line break. I hope that now you know how to program in C from Linux. You see that installing the previous package from the console will serve you for any Linux distribution. You can program in C in Ubuntu easy whenever you want. You will only need to create a text file with a.c extension, compile it and run it as we saw above.
Nero or ashampoo: what is the best program to record videos?
When thinking about video recording, two software soon comes to mind: Nero and Ashampoo. However, what many people do not know is that both
Revo uninstaller pro, the best program to uninstall programs
Revo Uninstaller Pro Windows application that allows you to uninstall any program. The best that there is a portable and totally free option.
Chromecast preview program gives you access to new features
How to have early access to new features for Chromecast through Google's new “Preview Program”.