Starting C for Perl coders

In my quest to write an ‘app’ for the iPhone, I’ve been sidetracked into learning ANSI-C from scratch to give me a grounding for C++ and Objective-C. Why you may ask? Well it occurred to me that as FreeBSD in mainly written in C and C++ and if you really want to extend things such as Sendmail (via Milter), then you can do a lot worse than knowing ┬ábit of C or C++. The of course the Objective-C should be a walk in the park!

First things first, a copy of the K&R book on C is the basis of all C instruction, also I subscribe to so have sat through some instruction videos on ‘Programming C’ which was bearable. Having installed Xcode on my Mac(s) means i can now write simple programs with ‘Text Wrangler’ and use the ‘cc’ program to compile and link them as shown below. Here’s a demo of the source file (with a .c extension), compile and link, followed by running:

# cat hello_world.c
#include <stdio.h>

	printf("Hello World!\n");

# cc -o hello_world hello_world.c
# ./hello_world
Hello World!

Pretty straightforward.

This entry was posted in C and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *