primary Data types
primary Data types
Int
Integers are whole numbers. Short int represents fairly small integer values and requires half the
amount of storage as a regular int number
uses. Unlike signed integers, unsigned
integers use all the bits for the magnitude
of the number and are always positive. We
declare long and unsigned integers to
increase the range of values. The use of
qualifier signed on integers is optional
because the default declaration assumes a
signed number. Eg) int a; long int a;
unsigned int a;
Float
Floating point (or real)
numbers are stored in 32 bits
with 6 digits of precision.
Floating point numbers are
defined in C by the keyword
float. When the accuracy
provided by a float number is
not sufficient, the type double can be used to define the number. A double data type number uses
64 bits giving a precision of 14 digits. These are known as double precision numbers. Double type
represents the same data type that float represents, but with a greater precision. To extend the
precision further, we may use long double which uses 80 bits. Eg) float x; double x; long dpuble x;
Void Types
The void type has no values. This is usually used to specify the type of functions. The type of a
function is said to be void when it does not return any value to the calling function. It can also play
the role of a generic type, meaning that it can represent any of the other standard types.
Character Types
A single character can be defined as a character(char) type data. Characters are usually stored in 8
bits (one byte) of internal storage. The qualifier signed or unsigned may be explicitly applied to
char. While unsigned chars have values between 0 and 255, signed chars have values from –128
to 127.
Eg) char y;