built in data types in c++ code example

Example 1: Data Types in C++

Data types in c++
	Built-in                User Defined            Derived
    ----------              -----------             ------------
    void, int,			    structure,              array,
	char, float,		    union,					function,
    double, bool,		    enum,					pointer,
    long long			    class,					reference
    Wide Character		    typedef

Example 2: All data types in C++

Data Type 										Size
int (Integer) = 5, 6, 7							2
float (Floating Value) = -3.67, 2.67			4
double (Double of float) = -7.8746				8
char (Character) = 	'a', 'b', 'A'				1
string (Multiple chars) = "Hello World" 		No of Chars
bool (Boolean) = true, false					true = 1, false = 0

Example 3: data types in c++

int myNum = 5;               // Integer (whole number)
float myFloatNum = 5.99;     // Floating point number
double myDoubleNum = 9.98;   // Floating point number
char myLetter = 'D';         // Character
bool myBoolean = true;       // Boolean
string myText = "Hello";     // String

Tags:

Cpp Example