Translate

Labels

Showing posts with label DATA TYPES. Show all posts
Showing posts with label DATA TYPES. Show all posts

Sunday, 30 December 2012

DERIVED DATA TYPES

Long, double,unsigned ,array and pointers are the derived types from the fundamental primitive 
types.A long integer can be declared as follows:

long int i;

or

long  i;

To store a long integer value, four bytes of memory are required.To store the real (float) values more precise, the type double is used.It occupies 8 bytes n the memory.

Unsigned numbers are represented as follows:

unsigned int i;

 unsigned int occupies 2 bytes as normal integers but all the bits are used to store the value.In a regular integer,the most significant bit (the left most bit is a sign bit)

FUNDAMENTAL DATA TYPES

Data is a one of the most commonly used terms in programming.Data can be defined as the raw information input to the computer.Data is differentiated into various types in C.There are three numeric data types that comprise the fundamental or primary data types are: 

  • int,
  • float and
  • char.

they are also called as pre define primitives associated with C compiler.The C compiler knws about these  types and the operations that can be performed on the values of these types.The following are the declaration statements of variables of different types:

  • int x;
  • float f;
  • char ch;

 We know already that an integer is a whole number, a float is areal number and a character is represented within single quotes.

eg:
1    is an integer (whole number)
1.0 is areal number (floating point number)
'1'  is a character constant
"1" is a string literal

The data types associated with a string literal is char*(character pointer )
An integer requires 2 bytes of memory to store its value, a float requires 4 bytes of memory and a character requires 1 byte of memory

Friday, 21 December 2012

DATA TYPES AND THEIR RANGE


                                                                                                     2^(X-1)  to  2^(x-1)-1
TYPE
LENGTH
RANGE
Unsigned char
8 bits-> 1 byte
0 to 255
char
8 bits-> 1 byte
-128 to 127
enum
16 bits->2 byte
-32,768 to 32,767
Unsigned int
16 bits-> 2byte
0 to 65,535
Short int
16 bits-> 2 byte
-32,768 to 32,767
int
16 bits-> 2 byte
-32,768 to 32,767
Unsigned long
32 bits->4 byte
0 to 4,294,967,295
long
32 bits->4 byte
-2,147,483,648 to 2,147,483,647
float
32 bits-> 4 byte
3.4*(10**-38) to 3.4*(10**+38)
double
64 bits-> 8 byte
1.7*(10**-308) to 1.7*(10**+308)
Long double
80 bits-> 10 byte
3.4*(10**-4932) to 1.1*(10**+4932)



                                                                                       x->bits