Friday, September 12, 2008

Learnigns of the Week (ROLLORATA)

DATA TYPES

DATA TYPES AND KEYWORDS

l There are five elementary data types in C: character (char), integer (int), floating point, double floating point and void.

CHAR
l Values of type char are used to hold ASCII characters or any 8-bit quantity.

INT
l Variables of type int are used to hold real numbers. Real numbers have both an integer.

Float and Double
l Values of type float and double are used to hold real numbers.
l Rea numbers have both an integer and fractional component.

Void
l The type void has three uses:
– To declare explicitly a function as returning no value.
– To declare explicitly a function as having no parameters.
– To create generic pointers.

Type Bidwidth Range

char 8 0 to 255
int 16 -32768 to 32767
float 32 3.4 X 10-38 to 3.4 X 1038
double 64 1.7 x 10-308 to 1.7 x 10308
void 0 valueless


Type Modifiers
l Except type void, the basic data types may have various modifiers preceding them.
l A modifier is used to alter the meaning of the base type to fit the needs of various situations more precisely.

Type Modifiers
l The list of modifiers includes the following:
– Signed
– Unsigned
– Long
– Short

Keywords
l Keywords in C are reserved words that have a special meaning.
l Reserved words are words “reserved” by the programming language for expressing various statements and constructs, thus, these may not be redefined by the programmer.

Keywords
l List of 32 Keywords / Reserved words as defined by the ANSI standard.
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

No comments: