Friday, 24 February 2012

Constants And Variables

The alphabets, numbers and special symbols when properly combined form constants, variables and keywords. A constant is an entity that does not change.

Variables:
A variable is an entity that may change it value. In any program we typically do lots of calculations. The results of these calculations are stored in computer memory locations. To make the retrieval and usage of these values we give names to the memory locations. These names are called variables.

Keywords:
A keyword is a word that is part of C Language itself. These words have predefined meanings and these words cannot be used as variable names.
C Keywords
charsignedbreakfor
autoconstsizeofcase
ifexterndoublestruct
continuegotoregisterenum
typedefdefaultreturnstatic
floatuniondoswitch
volatileintunsignedelse
whilelongvoidshort


Types of Variables
There are two main types of variables in C: numeric variables that hold only numbers or values, and string variables that hold text, from one to several characters long.

Basic fundamental data types in C Language
NameDescriptionSizeRange
charCharacter or small integer.1bytesigned: -128 to 127
unsigned: 0 to 255
short intShort Integer.2bytessigned: -32768 to 32767
unsigned: 0 to 65535
long int (long)Long integer.4bytessigned: -2147483648 to 2147483647
unsigned: 0 to 4294967295
boolBoolean value. It can take one of two values: true or false.1bytetrue or false
floatFloating point number.4bytes+/- 3.4e +/- 38 (~7 digits)
doubleDouble precision floating point number.8bytes+/- 1.7e +/- 308 (~15 digits)
long doubleLong double precision floating point number.8bytes+/- 1.7e +/- 308 (~15 digits)

No comments:

Post a Comment