Pages

Friday, 4 October 2013

Constants, Variables and Keywords in C Language

Constants:

             If we declare Identifier as constant then we can not change value of the Identifier during execution of the Program.

  • Identifier is a name of the Variable  


Numerical Constants:

Integer Constants:

Sequence of the Numbers from 0 to 9 except decimal points
Integer constants are neither Positive nor Negative or Zero.

Ex: 25, 63 , 852 ,  -45 ,-90 , 0 …etc.

Real Constants:

The floating points or decimal points is knows as Real Constants.

Ex: 63.25, -963.2 …etc.

Complex Constants:

Complex Constants are divided into 2 parts

1. Real Part
2. Imaginary Part.

In Real and Imaginary part. we will take Real values.

Character Constants:

Single Character Constants:

The character is called a single character constants and it is enclosed with in the single quotes ( ‘ ' ) .

Ex: ‘d’ , ‘c’ ,….etc.

String Constants:

Group of characters or collections of characters are called String Constants and it is enclosed with the double quotes( " ").

Ex: “ c language “, “56+23”, “string constants" :…etc.

Boolean Constants:

0 or 1 is called Boolean constants.

Coding Constants:

Literal Constants:

Unchanged values in the expression is called literal constants.

Ex; 2x+4y=15 here 2,4,15 unchanged values.

Defined Constants:

Defined constants are used in macros and file inclusion … etc.

#define size 5, #define pi 3.14 …etc.

Memory Constants:

Memory constants are unchangeable if we initialise the value once we can’t reinitialise.

 Ex: const int a=10 ,const int x=25 ..etc.


Variable:

Variable is name of the memory location whose value can be changed from time to time.

Ex: a, x, sname , vage , ..etc.

Key words or Reserved Words:

In c language the meaning of the Keywords and content of the Keywords already defined. We can not change meaning of the key word or content of the keywords.


C consists of 32 key words: 

void
double
break
register
int
if
continue
extern
short
else
return
struct
long
while
goto
union
signed
for
sizeof
typedef
unsigned
do
volatile
enum
char
switch
auto
default
float
case
static
const

later 5 key words added i.e.

_Bool,  _Imaginary,restrict, _Complex, inline.



No comments:

Post a Comment