How to Program in C-simple Tutorial

by musicman432 in Circuits > Software

7737 Views, 22 Favorites, 0 Comments

How to Program in C-simple Tutorial

1.jpg

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.

Write Source Code

2a.jpg
2b.jpg
open the program Terminal in your Utilities folder, then type pico at the prompt.

Type Source Code

3.jpg
Okay, now type this into the pico editor:

#include

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

Save Your Program

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

Next, quit pico(Ctrl+x).

Compile!

5.jpg
Type into the prompt:

gcc HELLO.C -o Hello

Run Your Program!

6a.jpg
6b.jpg
In the prompt, type:

./Hello


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