2. Programming in Objective-C

In this chapter we'll dive right in and show you how to write your first Objective-C program. You won't work with objects just yet; that is the topic of the next chapter. We want you to understand the steps involved in keying in a program and compiling and running it. Special attention is given to this process under Windows and on a Macintosh computer.

To begin, let's pick a rather simple example—a program that displays the phrase Programming is fun. on your screen. Without further ado, here is an Objective-C program to accomplish this task.

Program 2.1.

// First program example#import <stdio.h>int main (int argc, const char *argv[]){  printf ("Programming is fun.\n");  return 0;}

Before we go into a detailed explanation ...

Get Programming in Objective-C now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.