Datatypes in C++

 


😘1.Datatype in C++

>>Datatype is a key word
>>Its main purpose is to allocate the memory for variable.
>> Datatypes specify the types of variable to be stored in the memory location.

Data types are three types
 I】Primitive (or) fundamental (or) Bullet in the datatype.
II】Derived data type.
III】User defined data type.

I】Primitive Data types 

It is the data type whose variables can store maximum 1 value.
 Primitive data types are mainly 4 types :
i]Integral data 
ii]Float datatype data type 
iii]Double datatype 
iv]Character data type

😜I]Integral data😜
>>It Can be identified with the keyword.
>>It can you should the handle integer values
>>Size of an entity type is 2 bytes
Range of int data type is - 2 ^15 2 + 2 ^ 15-1.(-32,768 to+32,767).
 ∆ Range represent the minimum and maximum value that are accepted by data type.
Ex:-int a=5;

😳ii]Float datatype data type😳
>> It can be identified with a float keyword
>> It can be used to identify a real data
>> Size of float data type is 4 bytes
>> Ranger funny float data type is - 2 ^ 32 ^ to+ 2^32
Ex:-float a=7.4;

😅iii]Double datatype😅 
>> It can be identified with double keyboard
>> It can be used to identify real data
>> Size of a double data type is 8 bytes
>> Range of funny double data type is 2 ^ 63to+2 ^ 63 - 1
Ex:-double a=1.6936

🙄iv]Character data type🙄
>>It  can be identified with char keyword
>>It can be used to identify the character data type.
>>Size of char data type is 1 bytes
>>Rang character data type -2 ^ 7to2^7 - 1
Ex:-char a='3';
       char a='z';

>> Character data type can handle single character directly what is the difference between float and double.
>> float occupies 4 bytes memory whereas double occupies 8 bytes in memory
>> float accept minimum 6 and maximum 8 extra fractions values where as double accept minimum and maximum 16 extra fractional values.
👽Data modifiers/Qualifier👽
These are the keywords used to change current property of datatypes.

💐Size Qualifiers:-
Type qualifiers altis the size of the basic data type that key words long and short after two size qualifiers
long:-
long is a keyboard which can be used before the in tour and it will add two bytes to the current data type size
Ex:-long int a=10;
(or)                   >>occupies 4bytes of memory
long a=10;
long double b=5.7987     >>Occupies 10 bytes
short:-
short is a keyword which can be used to allocate 2 bytes of memory irrespective of operating system 2bytes of memory in Windows operating system and 4 bytes of memory in Lunix operating system if be used short keyword before the into data type it can be allocated to bytes of memory in any operator system.
Ex:-short int a=10;
(or)        >>it occupies 2bytes of  memory in any operating system
short a=10;

💐Sign Qualifiers:-
Whether a variable can be hold only +ve value (or) both values specified by a sign qualifier. The keywords signed and unsigned are the two sign qualifiers.
Ex:-singned int a=10;
(or)
singned int a=-10;

💐Unsigned:-
Unsigned is a Keyword which will accept only positive values
Ex:-unsigned int a=10;
(Or).      >>a=10,a=-10 stories same value
unsigned int a=-10;

Derived Data types:-
>>Derived data types are the data types which variable can store more than one value of similar type.
>> Derived data types can be achieved by using array.
Array:- Array is collection of similar (or) homogenous data type.

User defined data types:-
These are the data types which variable can store more than one values of disimilar type.
TypeSize in bytes
char1
unsigned char1
signed char1
int2 (or) 4
unsigned int2 (or) 4
signed int2 (or) 4
short int2
long int4
unsigned short int2
signed short int2
long int4
unsigned long int4
signed long int4
float4
double8
long double10
                                                                                

Comments

Popular posts from this blog

History of C language

Lab programs of C

Algorithm Pseudopods Flow-chat