Basic Data Type
1. int
Output Format: % I, % d, % o % x,
2. Float
Output Format: % F, % E, % G
3. Double
Output Format: % F, % E, % G
4. Char
Output Format character: % C
Qualifier:
1. Long
Long INT: % Li
Long double: % lf
To form a long int, add L after the number.
Long int number = 123324123234123l;
2. Long
Long long INT: % llI
3. Short
Short INT: % Hi
4. unsigned
5. Signed
The number of bytes each occupies.
# Import<Foundation/Foundation. h>
IntMain (IntArgc,Const Char* Argv []) {
NSAID utoreleasepool* Pool = [[NSAID utoreleasepool Alloc]Init];
Nslog(@ "The size of an int is: % d bytes .",Sizeof(Int));
nslog ( @" the size of a short Int Is: % d bytes. ", sizeof ( short int ));
nslog ( @" the size of a long Int Is: % d bytes. ", sizeof ( long int ));
Nslog(@ "The size of a char is: % d bytes .",Sizeof(Char));
Nslog(@ "The size of a float is: % d bytes .",Sizeof(Float));
Nslog(@ "The size of a double is: % d bytes .",Sizeof(Double));
Nslog(@ "The size of a bool is: % d bytes .",Sizeof(Bool));
[PoolDrain];
Return 0;
}
09:29:16. 475 sizeoftest [860: 903] the size of an int is: 4 bytes.
09:29:16. 478 sizeoftest [860: 903] the size of a short Int Is: 2 bytes.
09:29:16. 478 sizeoftest [860: 903] the size of a long Int Is: 8 bytes.
09:29:16. 479 sizeoftest [860: 903] the size of a char is: 1 bytes.
09:29:16. 479 sizeoftest [860: 903] the size of a float is: 4 bytes.
09:29:16. 479 sizeoftest [860: 903] the size of a double is: 8 bytes.
09:29:16. 480 sizeoftest [860: 903] the size of a bool is: 1 bytes.
Logout