2 types :
1.Simple or Primitive :
integers, floats, characters, pointers.
2.Compound or derived or Structured :
Derived data is made up of one or more simple data items.such as arrays, structures, unions.
I wanna give Just-an-Outline about them :
Integers in C:
Integers stores numeric value without a decimal point in the system memory.
Memory Allocation :1. Short int ----:> 2 Bytes
2. Int ----:> 4 Bytes
3.Long int ----:> 4 Bytes
Floats in C :
It stores numeric values with decimal point in the system memory.
Memory Allocation : 1. Float ----:> 4 Bytes
2.Double ----:> 8 Bytes
3.Long double ----:> 10 Bytes
Characters in C :
Characters is data type which stores an element of machine character set.
The character set is used is usually ASCII set, it is denoted by char.
It takes only one byte. Also signed and unsigned both occupy one byte
having different ranges.
The primary data type themselves could be of several types. for example Character char could be Unsigned char. or Signed char. The values stores in the given integer variables will always be be positive. for example: we can declare a variables to be unsigned.
unsigned int num_student,
The range of integer values is -32768 to +32767 values for a 16 bit OS
to range 0 to 65535.char ch =A; where ASCII value of A is 65.
Characters Types, Size in Bytes and Range
Type Name Bytes Range
------------- 16 bit system -------------
------------- 16 bit system -------------
char 1 -128 to 127
signed char 1 -128 to 127
unsigned char 1 0 to 255
short 2 -32,768 to 32,767
unsigned short 2 0 to 65,535
int 2 -32,768 to 32,767
unsigned int 2 0 to 65,535
long 4 -2,147,483,648 to
2,147,483,647
unsigned long 4 0 to 4,294,967,295
float 4 3.4E+/-38 (7 digits)
double 8 1.7E+/-308 (15 digits)
long double 10 1.2E+/-4932 (19 digits)
Type Name Bytes Range
char 1 -128 to 127
signed char 1 - 128 to 127
unsigned char 1 0 to 255
short 2 -32,768 to 32,767
unsigned short 2 0 to 65,535
int 4 -2,147,483,648 to 2,147,483,647
unsigned int 4 0 to 4,294,967,295
long 4 -2,147,483,648 to 2,147,483,647
unsigned long 4 0 to 4,294,967,295
float 4 3.4E+/-38 (7 digits)
double 8 1.7E+/-308 (15 digits)
long double 10 1.2E+/-4932 (19 digits)
No comments:
Post a Comment