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:
#include
int main()
{
printf("Hello!\n");
}
#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).
Next, quit pico(Ctrl+x).
Step 4: Compile!
Type into the prompt:
gcc HELLO.C -o Hello
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!
./Hello
This should run your program. Congratulations! You have just created your first C program!