C++ - Datatypes - Datatypes


Datatype tells what type of value hold by variable or what type of value variable can have.

There are five atomic data types in C:

character, integer, floating-point, double floating-point, and value (char, int, float, double, and void, respectively).

As you will see, all other data types in C are based upon one of these types. The size and range of these data types may vary between processor types and compilers. However, in all cases a character is 1 byte. The size of an integer is usually the same as the word length of the execution environment of the program. For most 16-bit environments, such as DOS or Windows 3.1, an integer is 16 bits. For most 32-bit environments, such as Windows NT, an integer is 32 bits.

However, you cannot make assumptions about the size of an integer if you want your programs to be portable to the widest range of environments.

	<datatype>  <variable_name> ;
	<datatype> <variable_name> = <value>;