Pages

Saturday, September 20, 2014

Objective C data type

Objective C data type

  • int        (4bytes).                
  • float     (4bytes).
  • double  (8 bytes). 
  • BOOL      (1 bytes).
  • char      (1 bytes).

int  =  Integer number.
float = Single precision floating point.
double = Double precision floating point.
BOOL  = Boolean type data ( true / false ).
char  = A single character.



data type example


int number = 121;
float number2 = 1.231;
BOOL aDeer = YES;    [ YES | NO ]




4 bytes = 32 bits = 2^32   =      4.294.967.296  possible value.


-2.147.483.648     ----------------------------    2.147.483.648

with unsigned ( command to use only positive value, no negative! ) we can make it from

0   ----------------------------   4.294.967.296


example:   unsigned int positive_number;



**float and double cant use unsigned.



modifier

data type can use modifier.

  • short
  • long

example:  short int  ( cost 2 byte).
                 long int ( cost 8 byte).
                 long double (cost 16 byte).