Datasheet
11
Chapter 1: Computer Programming Exposed!
are doing is providing a set of instructions for the computer to follow. The
preceding example is not perfect, but actually it is much closer to illustrat-
ing how Objective-C programming works than you might think. So, consider-
ing the peanut butter and jelly sandwich example, here is how you get your
lunch made (if you are lucky enough to have a chef):
1. You give your chef the recipe.
2. He or she gets the ingredients together and then follows the instruc-
tions on what to do with the ingredients.
Voilà, a peanut butter and jelly sandwich.
Figure 1-1 shows how a computer program works, using the peanut butter
and jelly sandwich example.
Figure 1-1:
The peanut
butter
and jelly
program
outputs
data.
Compiler
int main(int argc, char*argv[]) {
char* theSandwich = “I hate peanut butter and jelly”;
printf (theSandwich);
return 0;
}
I hate peanut butter
and jelly
05_522752-ch01.indd 1105_522752-ch01.indd 11 8/27/09 9:45:02 PM8/27/09 9:45:02 PM