C++ Notes
C++ Notes
A type of value that a variable can hold is called datatype. C++ supports
three types of datatypes, they are as follows :
1. User-defined datatypes
2. Built-in datatypes
3. Derived Datatypes
a) Structure
b) Union
c) Class
d) Enumeration
Syntax:
struct tagname
Datatype member1;
Datatype member2;
1
.
Datatypes member n;
};
Syntax:
union tagname
Datatype member1;
Datatype member2;
Datatypes member n;
} variable1, variable2….variable n;
enum datatype_name
Value1,Value2…value n
};
2
• It’s minimum value is -127
• It’s maximum value is +128
• Its default value is 0
• 1 byte= 8 bits
• It is used in arrays to reduce the space
• It is 4 times smaller than integer value.
3
char: It is a 16 bit value
• Its minimum value is ‘\u000’ - > 0
• Its maximum values is ‘\ffff - > 35000
• It is used to store any character