Reading
Add Comment
Data types use in Objective-c
In the Objective-C programming dialect, information sorts allude to a broad framework utilized for announcing variables or capacities of distinctive sorts. The sort of a variable decides the amount of space it involves away and how the bit example put away is translated.
The sorts in Objective-C can be named takes after:
S.N. | Types and Description |
---|---|
1 | Basic Types: They are arithmetic types and consist of the two types: (a) integer types and (b) floating-point types. |
2 | Enumerated types: They are again arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the program.The void sort may not be comprehended to you as of right now, so give us a chance to continue and we will cover these ideas in forthcoming sections. |
3 | The type void: The type specifier void indicates that no value is available. |
4 | Derived types: They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types. |
The show sorts and structure sorts are alluded to altogether as the total sorts. The sort of a capacity indicates the kind of the capacity's arrival worth. We will see essential sorts in the accompanying area though different sorts will be secured in the up and coming parts.
Integer Types
Taking after table issues you insights about standard number sorts with its capacity sizes and quality extents:
Type | Storage size | Value range |
---|---|---|
char | 1 byte | -128 to 127 or 0 to 255 |
unsigned char | 1 byte | 0 to 255 |
signed char | 1 byte | -128 to 127 |
int | 2 or 4 bytes | -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 |
unsigned int | 2 or 4 bytes | 0 to 65,535 or 0 to 4,294,967,295 |
short | 2 bytes | -32,768 to 32,767 |
unsigned short | 2 bytes | 0 to 65,535 |
long | 4 bytes | -2,147,483,648 to 2,147,483,647 |
unsigned long | 4 bytes | 0 to 4,294,967,295 |
To get the careful size of a sort or a variable on a specific stage, you can utilize the sizeof administrator. The declaration sizeof(type) yields the capacity size of the item or sort in bytes. Taking after is a case to get the extent of int sort on any machine:
#import <Foundation/Foundation.h>;
int main()
{
NSLog(@"Storage size for float : %d \n", sizeof(float));
return 0;
}
When you accumulate and execute the above system, it creates the accompanying result on Linux:
2013-09-07 22:21:39.155 dheeruapps[1340] Storage size for int : 4
Floating-Point Types
Taking after table issues you insights about standard buoy point sorts with capacity sizes and worth extents and their accuracy:
Type | Storage size | Value range | Precision |
---|---|---|---|
float | 4 byte | 1.2E-38 to 3.4E+38 | 6 decimal places |
double | 8 byte | 2.3E-308 to 1.7E+308 | 15 decimal places |
long double | 10 byte | 3.4E-4932 to 1.1E+4932 | 19 decimal places |
Taking after table issues you insights about standard buoy point sorts with capacity sizes and worth extents and their accuracy:
#import <Foundation/Foundation.h>;
int main()
{
NSLog(@"Storage size for float : %d \n", sizeof(int));
return 0;
}
When you assemble and execute the above system, it delivers the accompanying result on Linux:
The void Type
The void sort indicates that no worth is accessible. It is utilized as a part of three sorts of circumstances:
S.N. | Types and Description |
---|---|
1 | Function returns as void There are various functions in Objective-C which do not return value or you can say they return void. A function with no return value has the return type as void. For example, void exit (int status); |
2 | Function arguments as void There are various functions in Objective-C which do not accept any parameter. A function with no parameter can accept as a void. For example, int rand(void); |
The void sort may not be comprehended to you as of right now, so give us a chance to continue and we will cover these ideas in forthcoming sections.
0 comments:
Post a Comment