August 4, 2011

C Data Types

C has a concept of 'Data Types' which are used to define a variable before its use.
A C language programmer has to tell the system before-hand, the type of numbers or characters he is using in his program. These are data types.
C has different data types for different types of data and can be broadly classified as:
Primary data type
Secondary data type 
User-defined data type


Primary data type consist:
Character
Integer
Float
Double
Void
Enum etc..


Secondary data type consist:
Array
Pointers
Structure
Union


User-defined data type

user can define his own identifier that characterizes an existing data type. This user defined data type identifier can later be used to declare variables.


The size and range of different Data types are compiler dependent. sizes given bellow are for 16-bit Compiler
Data Type
Range
Bytes
Format
Signed char
-128 to +127
1
%c
Unsigned char
0 to 255
1
%c
Short signed int
-32768 to +32767
2
%d
Short unsigned int
0 to 65535
2
%u
Signed int
-32768 to +32767
2
%d
Unsigned int
0 to 65535
2
%u
Long signed int
-2147483648 to 2147483647
4
%ld
Long unsigned int
0 to 4294967295
4
%lu
Float
-3.4e38 to +3.4e38
4
%f
Double
-1.7e308 to +1.7e308
8
%lf
Long double
-1.7e4932 to +1.7e4932
10
%Lf

Hope you like the post, Comment bellow for your Query and Feedback... :)

Related Posts :



Categories:

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Related Posts with Thumbnails