int
An integer value between +/– 2,147,483,647.unsigned int
An integer value between 0 and 4,294,967,296.float
A floating point value between +/– 16,777,216.double
A floating point value between +/– 2,147,483,647.long
An integer value varying in size from 32 bit to 64 bit depending on architecture.long long
A 64-bit integer.char
A single character. Technically it’s represented as anint
.BOOL
A boolean value, can be either YES or NO.NSInteger
When compiling for 32-bit architecture, same as anint
, when compiling for 64-bit architecture,+/– 4,294,967,296.NSUInteger
When compiling for 32-bit architecture, same as anunsigned int
, when compiling for 64-bit architecture, value between 0 and 2^64
List of Scalar Data Types
-
28-11-2021 - |
Pergunta
Im looking for a list of all the scalar data types in Objective C, complete with their ranges (max/min values etc).
Sorry for the simple question, Im just really struggling to find anything like this.
Solução
Outras dicas
- 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
For more on sizes check this post
Integer types are signed 2's complement or unsigned and the standard C variations are provided (char
, short
, int
, long
, long long
and unsigned
variants of these, see C types on Wikipedia), sizes may vary dependent on 32-bit & 64-bit environments - see 64-bit computing.
BOOL
is an Objective-C special and is defined as signed char
, while it can take any value a signed char can the constants NO
and YES
are defined for use. The C9X type _Bool
(aka bool
) is also provided.
float
& double
are IEEE 32-bit & 64-bit floating point - see Wikipedia for ranges.
Standard macro contants are provided for the minimum and maximum of all the types, e.g. INT_MAX
for int
- again see C types on Wikipedia for these.