Exercises

1. Type in and run the five programs presented in this chapter. Compare the output produced by each program with the output presented after each program.

2. Write a program that displays the following text:

In Objective-C, lowercase letters are significant.main is where program execution begins.Open and closed braces enclose program statements in a routine.All program statements must be terminated by a semicolon.

3. What output would you expect from the following program?

#import <Foundation/Foundation.h>int main (int argc, const char * argv[]){   @autoreleasepool {      int i;      i = 1;      NSLog (@"Testing...");      NSLog (@"....%i", i);      NSLog (@"...%i",  i + 1);      NSLog (@"..%i", i + 2);   }   return 0;}

4. Write a program ...

Get Programming in Objective-C, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.