loading

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:

#include

int main()
{
printf("Hello!\n");
}

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:

./Hello


This should run your program. Congratulations! You have just created your first C program!
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?
Can you make C files in Notepad++?
Yes, but I believe that is only an editor. You would need to find a compiler too, such as the open source GCC compiler, try <a rel="nofollow" href="http://www.mingw.org/">http://www.mingw.org/</a> or just google &quot;gcc for windows&quot;.<br/>
thx
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 <a rel="nofollow" href="http://www.processing.org">Processing</a> to people who want to learn C. This is an &quot;environment&quot; with C underneath, but with major features implemented as a sort of &quot;subset&quot; 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 &quot;microcontroller&quot; space, <a rel="nofollow" href="http://www.wiring.org.co/">Wiring</a> and <a rel="nofollow" href="http://www.arduino.cc/">Arduino</a> do the same thing (and in fact are based on the same core environment, I believe.))<br/>
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 :]

About This Instructable

6,516views

21favorites

More by musicman432:Mod the Mini ZT456 gun into airsoft pistol How to program in C-simple tutorial 
Add instructable to: