Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to learn C language . and i would like to know how i can practice on C language by using Ubuntu 12.04

And is there any platform for it and how to get it ? or learn it by Terminal and how to use it to ?

Thanks for reading :)

share|improve this question

closed as off topic by jokerdino, Tachyons, Amith KK, izx, fossfreedom Jul 15 '12 at 17:25

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Take a look at How could I begin C++ programming on Ubuntu? –  Peachy Jul 15 '12 at 5:22
    
You topic is broad and may create discussion. There are many way to use and practice C in Ubuntu. Also I think, there are at least 2 different questions in it. –  Anwar Shah Jul 15 '12 at 5:36
    
this too much thing i confused !! i want determinables name or explansion links please ! –  amrelghobary Jul 15 '12 at 5:48
2  
^^^ Now I'm confused? Basic C/C++ programming and fundamentals are the same no matter what OS you use. Maybe you could go to your localc computer bookstore and look at a few books? –  izx Jul 15 '12 at 6:31
    
this is perhaps the wrong stackexchange - this would be ontopic (with perhaps much better answers) on the StackOverflow.com SE site. –  fossfreedom Jul 15 '12 at 17:26
add comment

2 Answers 2

up vote 3 down vote accepted

NOTE : Refer Online resources for C learning tutorials , i am only linking the Tools and Platform available In Ubuntu ,needed for you to begin with C.

To use C and C++ you will need to install the build-essential package.

sudo apt-get install build-essential

You can now compile C and C++ programs with GCC and g++ .

Where GCC stands for “GNU Compiler Collection”. GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Java, Fortran, Ada, and Go.

You will find available Official Programming tools here and for Power Users Programming

To help you begin from Ground-Zero refer here for typing your Fisrt C program and how to compile it and another Example Tutorial using GCC.

To begin with : What you will basically need is an Editor from above , ( try Gedit as beginner, there are many to choose from) for compiling through Command Line

Or

Directly use IDE ( Integrated Development Environment) such as Geany ,Anjuta or Code::Blocks IDE.

Example Using text editor

enter image description here

Then in terminal

gcc hello.c -o hello1   

./hello1   

which will give O/P like

user@host:~/Desktop$ ./hello1
Hello! This is my first C program with Ubuntu 12.04
share|improve this answer
    
Great! thanks for that. but can i have some linke for how to use it ?? i can't distinguish and know what is the GCC OR G++ ? –  amrelghobary Jul 15 '12 at 5:47
    
i faield to use it ....sorry :) –  amrelghobary Jul 15 '12 at 7:49
    
anyway thanks brother i will try to use it later maybe iwill know more that will help me :) –  amrelghobary Jul 15 '12 at 9:29
add comment

If you want to use and practice only C, then you can use the default gcc compiler (which is installed by default as C compiler on almost every Linux distribution) . From your question, I suppose you also wanted to use this in terminal. Here I give a simple example of a C program using terminal.

  • Open a terminal and type nano hello.c and Press Enter.
  • An editor will be opened in terminal. This is nano. Type the following to create a simple C program

#include <stdio.h>

int main(){

    printf("Hello C, I am in Ubuntu\n");
    return 0;
}

  • Then Press CTRL+O to write to the file. Then press CTRL + W to exit nano.
  • Then type gcc -o hello hello.c. It will compile the hello.c file and create an executable with name hello.
  • Then type ./hello to see the output of the program.

Note: The details explanation of the program is beyond the scope of the answer.

You can check these link to learn more about gcc compiler and using C in Ubuntu.

gcc online documentation

gcc manual page

Learn C online

C programming tutorial

share|improve this answer
    
you are Great! you read my mind and give what i want .. thanks you .. Good luck –  amrelghobary Jul 15 '12 at 8:49
    
You can accept this if it helps by clicking on the grey tick mark at the left had side of the answer. Thanks. –  Anwar Shah Jul 15 '12 at 9:51
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.