c++ Data types

C++ Data Types


What is the data types in c++?

Data types define the data of the variables in the c++ such as int(integer),char(character),float(fractional numbers),and boolean types.

Data types in the c++ are divided into three groups 
  1. Built-in
  2. Derived
  3. User-defined

Built-in data types

C++ Int type

Keyword:
For  integer type  int keyword is used to declare 
size:
The size of the int is 4 bytes
Range of the number int can store  214748647 to -2147483648
For example:
int number = 410;

C++ Float type

For the floating type of numbers(fractional number),
Keyword:
float keyword is used to declare 
size:
The size of the float is 4 bytes

For example:
float number = 410.45;


 C++ Double type


The double type also use for the fractional and exponential number but only different from the float type is double give more precision as compared to float data type.
Keyword:
Double keyword is used to declare
Size:
The size of the double is 8 bytes

For example:
double number=23.543126785

C++ char


The char is used for declaring and using characters in the c++ language.
Keyword:
char is the keyword for the char type of data.
Size
The size of the char is 1 byte.

For example:
char ch='A';


C++ Bool

The bool is used for booleans,true or false.
Bool has two possible output yes or No.
Booleans mostly use in the conditions of the if statement
Keyword:
bool is the keyword for the boolean type of data.
Size:
The size of the bool is 1byte.

For Example:
bool num=0;

C++ void

The void is used for nothing or the absence of the data type.
Void is used in the functions or pointers.

cpp data type
Data types

Derived data type

The following are derived-defined data types in the CPP.
Pointer
Array
Function
These types are derived from the basic data type of the CPP language. That's why called derived data types.
You can visit pointers,arrays or functions for learning about these derived data types


User-defined data type

These data types which are defined by the user are called user-defined data types.
The following are examples of a user-defined data type.
Structure
class
Union
Typedef 

Please write the comment,if you find anything incorrect and any problem in the above topic or you want to share more information about the above topic.

Comments

Popular posts from this blog

Flutter layout

Diferrence between flutter and react native

how to cout in cpp