Getting started with C in Ubuntu

Are you a developer who just installed Ubuntu as your primary Operating System? No worries...Ubuntu was practically made for programming in languages such as C, C++, C#, Java, and many more.But do you want to know how to get started? Of couse you do, Let's get to developing!

Installing the GNU C Compiler
Go to the top left corner of you destop and click on the Search application on your launcher. In the search box enter "Terminal" And execute it. You will get a black window with some pretty confusing text but it's not really that important. You will now need to execute the following commands inside the terminal.

sudo apt-get update

When this process finishes you will then need to execute another command.

sudo apt-get upgrade

Now this process may take a while considering your internet connection. Just be patient you will be Developing on Ubuntu in no time. When this process finishes We will now install the compiler it's self. Just execute this command and you will do fine.

sudo apt-get install build-essential

When this finishes let's execute a couple other commands just for good measure.

gcc -v

make -v

Creating programs in C with Ubuntu
Now you may have noticed already but Ubuntu is heavily influenced by the "Terminal". So if you have done everything correctly you should be able to start a new program from the terminal. Doing so is easy just execute the following command and it will launch G Edit. This is the interface at which you will create your program.

Command: sudo gedit filename.c

Now you have executed G Edit. Now this tutorial is assuming that you already know C so I will leave editing the program to you. When you are finished save your new .c file and return to the terminal. We will now compile your program using this command

cc -c filename.c

If you get any errors try editing your program of syntax errors and such. then try recompiling. Now to be able to run your program we need to make it executable, so let's do so by using this command.

cc -o name filename.c Where name is the name of your program without the file extention.

Now for the final test let's run your program. Do this to execute it.

./filename Where filename is what you named you program.

And BOOM! Did you do everything right? If so you have just created and ran you new C program in the best Operating System in the world. Have fun with your new tools