How to Program in C-simple Tutorial


Introduction: How to Program in C-simple Tutorial

Please Comment if you like this!

This Instructable will teach anyone to write a simple program in the C programming language.

What you will need:

a Macintosh Computer with the Developer tools installed,
and some brain power.

Step 1: Write Source Code

open the program Terminal in your Utilities folder, then type pico at the prompt.

Step 2: Type Source Code

Okay, now type this into the pico editor:


int main()

Step 3: Save Your Program

Now, save (Ctrl+o) the file as HELLO.C

Next, quit pico(Ctrl+x).

Step 4: Compile!

Type into the prompt:

gcc HELLO.C -o Hello

Step 5: Run Your Program!

In the prompt, type:


This should run your program. Congratulations! You have just created your first C program!



    • Oil Contest

      Oil Contest
    • Water Contest

      Water Contest
    • Clocks Contest

      Clocks Contest

    8 Discussions

    I am a C programmer. Although I wouldn't have ever learned much from this, it is nice to see something not Batch. P.S. Is it possible to tell an autorun.inf file to run a C program?

    that's not realy a c tutorial, it's more like how to write a c program

    I think that these days I'm inclined to recommend something like Processing to people who want to learn C. This is an "environment" with C underneath, but with major features implemented as a sort of "subset" so that you don't have to worry about quite as much. Also, it includes libraries of functions aimed at allowing relatively non-technical people to do fancy things (graphics...) (In the "microcontroller" space, Wiring and Arduino do the same thing (and in fact are based on the same core environment, I believe.))

    Let me tell you something -- I like it. Cool for a first instructable too. :-)

    It would have been nice if you had included some information explaining what each part of the code does. Such as '#include' being used to include an external header file. 'int main' is the body of the program etc I can't confess to knowing much C, which is why even the most basic of knowledge would be of use. Well done on your first Instructable through, nice to see something other than Batch :]