| 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 byte |
| BOOL | Boolean (signed char) | 1 byte |
enum typeName { identifier1, ... identifiern};
typedef typeName identifier;
const type identifier = value;
#define identifier value
| Operator | What It Does |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| % | Modulo |
| Operator | What It Does |
|---|---|
| == | Equal to |
| != | Not equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |
| Operator | What It Does |
|---|---|
| ! | NOT |
| && | Logical AND |
| || | Logical OR |
| Operator | What It Does |
|---|---|
| += | Addition |
| -= | Subtraction |
| *= | Multiplication |
| /= | Division |
| %= | Modulo |
| &= | Bitwise AND |
| |= | Bitwise Inclusive OR |
| ^= | Exclusive OR |
| <<= | Shift Left |
| >>= | Shift Right |
| Operator | What It Does |
|---|---|
| ++ | Addition |
| — | Subtraction |
| *= | Multiplication |
| /= | Division |
| %= | Modulo |
| &= | Bitwise AND |
| |= | Bitwise Inclusive OR |
| ^= | Exclusive OR |
| <<= | Shift Left |
| >>= | Shift Right |
| Operator | What It Does |
|---|---|
| & | Bitwise AND |
| | | Bitwise Inclusive OR |
| ^ | Exclusive OR |
| ~ | Unary complement (bit inversion) |
| << | Shift Left |
| >> | Shift Right |
| Operator | What It Does |
|---|---|
| () | Cast |
| , | Comma |
| Sizeof() | Size of |
| ? : | Conditional |
| & | Address |
| * | Indirection |
if else
if (condition) {
statement(s) if the condition is true;
}else {
statement(s) if the condition is not true;
}
for
for (counter; condition; update counter) {
statement(s) to execute while the condition is true;
}
for in
for (Type newVariable in expression ) {
statement(s);
}
or
Type existingVariable ;
for (existingVariable in expression) {
statement(s);
}
while
while (condition) {
statement(s) to execute while the condition is true
}
do while
do {
statement(s) to execute while the condition is true
} while (condition);
Jump statements
return ;
break ;
Leave a loop.
continue;
Skip the rest of the loop and start the next iteration.
goto labelName;
...
labelName:
An absolute jump to another point in the program (don’t use it).
exit();
Terminates your program with an exit code.
Interface
#import "Superclass.h"
@interface ClassName : Superclass {
instance variable declarations;
}
method declarations
@property(attributes) instance variable declaration;
–d
Implementation
#import "ClassName.h"
@implementation ClassName
@synthesize instance variable ;
method definitions
–d
Message Syntax
[receiver message]
#import
#import “filename.h”
Guarantees that a header file will be included only once.
class=""
class="" ClassName;
Clues the compiler into user defined types.