Objective-C Programming For Dummies
Book image
Explore Book Buy On Amazon

The variables you declare in Objective-C — Objective-C data types — must be a type that the compiler can recognize. Objective-C comes with a number of built-in data types, as well as mechanisms to create new ones, for programming your iOS or Mac OS X applications.

Built-In Types
Type Description Size
char A character 1 byte
int An integer — a whole number 4 bytes
float Single precision floating point number 4 bytes
double Double precision floating point number 8 bytes
short A short integer 2 bytes
long A double short 4 bytes
long long A double long 8 bytes
BOOL Boolean (signed char) 1 byte
Enumeration types
<span class="code">enum  typeName { identifier1, ... identifiern};</span>

Identifiers are of constants of type int.

typedef

typedef  typeName  identifier;

Associates an identifier with a specific type.

Constants

const type  identifier  = value;
#define identifier value

Allows you to define names for constants.

About This Article

This article is from the book:

About the book author:

Neal Goldstein is a veteran programmer and trusted instructor of iOS programming topics. He is the author of all editions of iPhone Application Development For Dummies. Karl Kowalski is a programmer who specializes in security and mobile apps and author of Mac Application Development For Dummies.

This article can be found in the category: