How to Program in C-simple Tutorial
by musicman432 in Circuits > Software
7761 Views, 22 Favorites, 0 Comments
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.
Write Source Code


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

Okay, now type this into the pico editor:
#include
int main()
{
printf("Hello!\n");
}
#include
int main()
{
printf("Hello!\n");
}
Save Your Program

Now, save (Ctrl+o) the file as HELLO.C
Next, quit pico(Ctrl+x).
Next, quit pico(Ctrl+x).
Compile!

Type into the prompt:
gcc HELLO.C -o Hello
gcc HELLO.C -o Hello
Run Your Program!


In the prompt, type:
./Hello
This should run your program. Congratulations! You have just created your first C program!
./Hello
This should run your program. Congratulations! You have just created your first C program!