Variables
Variables are used to store values in them, in cpp each variable has different data type
int
, stores integers (whole numbers)
12, 43, 67, 2121321, 0 , -1 , are correct
0.2, 0.4, 0.234324, 12.21321, are wrong
double
, stores floating point numbers,
0.2, 0.4, 0.234324, 12.21321, are correct
char
, stores single characters, They should be written inside ' '
single quotes
'a', 'b', ' ', '1' , are correct
"a", 'ab', 1 , are wrong
string
, stores text, They should be written inside " "
double quotes
"a", "bfasf3121", "" , are correct
'ab', 1 , are wrong
bool
, stores text, They should be written inside " "
double quotes
true, false, 1, 0, -1, 1609, "sdfa" , are correct