Saturday, January 31, 2015

Data Types in C


Data Types in C

A data type specifies the type of data that a variable can store such as integer, floating, character etc.
There are 4 types of data types in C language.
TypesData Types
Basic Data Typeint, char, float, double
Derived Data Typearray, pointer, structure, union
Enumeration Data Typeenum
Void Data Typevoid

Basic Data Types

The basic data types are integer-based and floating-point based. C language supports both signed and unsigned literals.
The memory size of basic data types may change according to 32 or 64 bit operating system.
Let's see the basic data types. It size is given according to 32 bit OS.

Data TypesMemory SizeRange
char1 byte−127 to 127
signed char1 byte−127 to 127
unsigned char1 byte0 to 127
short2 byte−32,767 to 32,767
signed short2 byte−32,767 to 32,767
unsigned short2 byte0 to 32,767
int2 byte−32,767 to 32,767
signed int2 byte−32,767 to 32,767
unsigned int2 byte0 to 32,767
short int2 byte−32,767 to 32,767
signed short int2 byte−32,767 to 32,767
unsigned short int2 byte0 to 32,767
long int4 byte
signed long int4 byte
unsigned long int4 byte
float4 byte
double8 byte
long double10 byte

No comments:

Post a Comment