Web Development

Starting C in Ubuntu

First we have to set up c environment in ubuntu

gcc and other neccessary compilers are not pre-installed in Ubuntu.
Execute this

Code:
sudo apt-get update
sudo apt-get install build-essential

In case your machine doesn’t have internet access, execute this first :

Code:
sudo apt-cdrom add

After setting up environment now time to coding. Simply we can create any file as like as test.c. We can open this file in VI editor. And writing some c code like as

#include
int main()
{
   printf("It's me\n");
   return 0;
}

Then save and quit from VI editor. Execute following command to compile and run the test.c file
To compile

gcc test.c

And run

./a.out

That’s it.

Advertisements

2 thoughts on “Starting C in Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s