Part 2 :- Data types in C++.
The following chart shows different data types in C++.
Data types in C++
Built-in
• int :-
(eg:- 1,3,6.....any integer).
• float. ( Eg:- 0.33,0.43,0.32,...decimal upto 7-digit).
• char.
( Eg :- c,j,d,... character).
• double.
(Eg:- 1.33,2.442.....decimal upto 15- digit).
• long double
( Decimal upto 19- digit).
• Booleans
(It will take 2 value and check the condition whether it is true or not).
Derived
- Pointer
• Array
• Function.
User defined
• Structure
• Class
• Union
• Enumeration
Variables
Declaration of a variable involved name of the variable & its data type.Variables can be declared anywhere before they are used ..
A variable is a container to hold data. Variable can be off various types.Primary we have these variable type in C ++
In simple words, we can say that Variables are used to store your given data .
A valid variable name may consists of alphabet, digits, underscore, but can't start with a digit.
e.g. int 45abc;
float =3.14 23 ; is not a valid variable name since it starts with digit. It has to be start with 0.
Syntax:-
Data type variable name = value;
Example :- int a=2 , b= 6
char a,b
float a= 0.2 ,b= 0.43



Comments
Post a Comment