Thursday, June 19

What are Identifiers and keywords in c++


Let's move ahead to our first basic definition what are identifiers?

As the name suggest identifier are the "name of the variables" and some program elements which are using the combination of the following characters.... which are:

Alphabets : a,b,c.......z, A,B,C,........Z

Numerals : 0,1,2........9

Underscore : _



Special characters : All characters other than which are listed as alphabets ,numerals and underscores are treated as special chracters. For example: [],blank space,() etc,

In c++ language, upper case and lower case letters are distinct and there 52 letters in all. A variable should not begin with a digit. C++ has not decided maximum length of the identifiers.

It mainly depends on the compiler.......

Some examples of good identifiers are:

My_name, i, I, h_Love etc...

Some examples such as :

3ab ------->> variable begins with a digit ------>> they are inadmissible to say a identifiers

a()test ------>> use of special characters ------>> they are inadmissible

gross salary ----->> space not allowed ------>> inadmissible

Keywords: The keywords are also identifiers but cannot be user defined since they are reserved words. The following words are keywords and remember they should not be choosen as the variables and identifiers, and believe me they all are in lower case letters.

asm, contine, float ,new, signed ,try
auto, default, for, operator ,sizeof ,typedef
break ,delete ,friend ,private, static ,union
case, do, goto, protected ,struct ,unsigned
catch, double, if ,public, char ,void
class, else, inline ,register ,template ,volatile
const, extern ,int, return ,this ,throw .

etc are the keywords. In next section we will learn about the constants.............

0 comments:

Followers

Archive

 

Money ,Entertainment and Education. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com