CHAPTER 3

image

Variables

Variables Defined

Objective-C stores information in variables. These are divided into two types: primitive types and composite types. Primitive variables store one piece of information, such as a number or a character. Composite variables store a set of information, such as three related numbers and a character.

Data Types

Table 3-1 shows the most common primitive data types that you will see in Objective-C.

Table 3-1. Objective-C Data Types

Data Type

Format Specifier

Description

NSInteger

%li

Signed integer

NSUInteger

%lu

Unsigned integer

BOOL

%i

Boolean (YES/NO)

CGFloat

%f

Floating point

 Note   Objective-C ...

Get Objective-C Quick Syntax Reference 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.