-
EURO INFORMATICA & EURO ELECTRONICA – TECHSOUP - August 7, 2018
-
Graham – algorithm - January 16, 2017
-
Fibonacci – recursive algorithm - December 13, 2016
-
Graphs – related components(algorithm) - December 12, 2016
-
JavaScript Comments - December 9, 2016
-
CSS Introduction - December 9, 2016
-
Java – Modifier Types and Basic Operators - December 8, 2016
-
Polinom – derivate(algorithm in C) - December 8, 2016
-
Euclid algorithm - December 8, 2016
-
Queue – algorithm (Sample 1) - December 8, 2016
Objective-C: Data types
In objective-c data types are:
- basic types;
- enumerated types;
- type void;
- derived types;
Integer types:
- char: 1 byte (-128 to 127)
- unsigned char: 1 byte (0 to 250)
- signed char: 1 byte (-128 to 127)
- int: 2 or 4 bytes (-32768 to 32767)
- unsigned int: 2 or 4 bytes (0 to 65535)
- short: 2 bytes (-32768 to 32767)
- unsigned short: 2 bytes (0 to 65535)
- long: 4 bytes (-2147483648 to 2147483647)
- unsigned long: 4 bytes (0 to 4294967295)
To get size of type data or variable you can use operator sizeof. Example:
#import <Foundation/Foundation.h>
int main(){
NSLog(@”Size of int is: %d\n”, sizeof(int));
return 0;
}
Result of above code is: “Size of int is: 4”.
Floating type:
- float: 4 byte (1.2E-38 to 3.4E+38)
- double: 8 byte (2.3E-308 to 1.7E+308)
- long double: 10 byte (3.4E-4932 to 1.1E+4932)
#import <Foundation/Foundatio.h>
int main()
{
NSLog(@”Size of float is: %d\n”, sizeof(float));
}
The void type specify a no value. It’s used for function returns a void or argument for a function( int rand(void)).
Example of void:
#import <Foundation/Foundation.h>
int main(void){
return 0;
}
void rand(){
}
274,904 total views, 9 views today