How use Objective-C Data Types ?

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
1Basic Types:
They are arithmetic types and consist of the two types: (a) integer types and (b) floating-point types.
2Enumerated 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.
3The type void:
The type specifier void indicates that no value is available.
4Derived 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:

TypeStorage sizeValue range
char1 byte-128 to 127 or 0 to 255
unsigned char1 byte0 to 255
signed char1 byte-128 to 127
int2 or 4 bytes-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int2 or 4 bytes0 to 65,535 or 0 to 4,294,967,295
short2 bytes-32,768 to 32,767
unsigned short2 bytes0 to 65,535
long4 bytes-2,147,483,648 to 2,147,483,647
unsigned long4 bytes0 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:
TypeStorage sizeValue rangePrecision
float4 byte1.2E-38 to 3.4E+386 decimal places
double8 byte2.3E-308 to 1.7E+30815 decimal places
long double10 byte3.4E-4932 to 1.1E+493219 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
1Function 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);
2Function 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

My Instagram