Data types in c

Data types in c

Data types in c programming, A data types defines a domain of allowed values and the what type of values will be store and what types of operations performs. storage represents every different data types with different memory blocks. in C languages there some data types predefined, Derived, Enumeration, void c basic data types

The C language supports following types of Data types

Types Data Types
Basic Data types int, char, float, double
derived Data types Array, pointer, union, structure
Enumeration Data types Enum
Void Data types void

Integer type

Integers are used to store whole numbers.

Size and range of Integer type on 16-bit machine:

integer data type and range

Floating point type

Floating types are used to store real numbers.

Size and range of float type on 16-bit machine:

float data type with range and size

Character type

Character types are used to store characters value.

Size and range of character type on 16-bit machine

char data type with size and range

so int is use to stored integer type value, char is used to store any single character, float is use for storing single precision floating point number and the last is double are use for storing double precision floating point number. These basic data types also divides into two types–
1. size qualifiers short, long
2. sign qualifiers signed, unsigned
talk about the qualifiers signed and unsigned are apply to char and integers types. Data types in c programming, when the qualifier signed is use store number may positive or negative, and when the qualifier is unsigned is used the number will always positive. if there is explicitly sign qualifier is not mention in integers, then the default signed qualifier is assume and for the char if sign qualifier is not mention explicitly. then the char is signed and unsigned depend on machine. talk about range the range of values of the signed data types are less than that of unsigned type.

The qualifiers long and short we can be apply to int type to get types short int and long int. And The Qualifier long we can applied to double to get type of long double.

And The sizes and range of different different data types on a 16-bit machine is given in this table. The size and range may be vary on machine by machine

Data types Memory Size(bytes) Range
Char
signed Char 1 byte -128 to 127
unsigned Char 1 byte 0 to 255
int
int or signed int 2 byte -32768 to 32767
unsigned int 2 byte 0 to 65535
short int or signed short int 1 byte -128 to 127
unsigned short int 1 byte 0 to 255
short int or signed short int 1 byte -128 to 127
long int or signed long int 4 byte -2147483648 to 2147483647
unsigned long int 4 byte 0 to 4294967295
float 4 byte 3.4E-38 to 3.4E+38
double 8 byte 1.7E-308 to 1.7E+308
long double 10 byte 3.4E-4932 to 1.1E+4932