4
Keywords and Reserved Words : Keywords are predefined identifiers, that are used in the syntax and can be used as identifiers again. Reserved words are the words in a programming language which has a fixed meaning and cannot be redefined by the programmer. They cannot be used as identifers(variables, functions etc). All reserved words and keywords are in lowercase letters. But be aware that this terminology is not standard. For example, In some books it was mentioned that Reserved words are also called as Reserved Keywords and some authors will use keyword in the same sense that we have used Reserved word. Infact all keywords are subset of Reserve words. Keywords can be redefined while Reserved words cannot be redefined and used. For example : #include<iostream> using namespace std; int main() // here main is the keyword { int main; // it can be redefined For Reference : http://comsciguide.blogspot.com/

Keyword

Embed Size (px)

DESCRIPTION

Keywords and Reserved words tells about the predefined identifiers which can be redefined and which can't be redefined.http://comsciguide.blogspot.com/

Citation preview

  • Keywords and Reserved Words :

    Keywords are predefined identifiers, that are used in the syntax

    and can be used as identifiers again.

    Reserved words are the words in a programming language

    which has a fixed meaning and cannot be redefined by the programmer.

    They cannot be used as identifers(variables, functions etc).

    All reserved words and keywords are in lowercase letters.

    But be aware that this terminology is not standard. For example, In

    some books it was mentioned that Reserved words are also called as

    Reserved Keywords and some authors will use keyword in the same

    sense that we have used Reserved word.

    Infact all keywords are subset of Reserve words.

    Keywords can be redefined while Reserved words cannot be

    redefined and used.

    Forexample:

    #include

    using namespace std;

    int main() // here main is the keyword

    {

    int main; // it can be redefined

    For Reference : http://comsciguide.blogspot.com/

  • main = 1;

    cout

  • confused with identifiers. In some languages, like C or Python, reserved

    words and keywords coincide, while in other languages, like Java, all

    keywords are reserved words, but some reserved words are not keywords

    these are "reserved for future use".

    HereisalistofReservedwordsandkeywords.

    C++ Rerserved words :

    The reserved words of C++ may be conveniently placed into 3

    groups. In the first group we put those that were also present in the C

    programming language and have been carried over into C++. There are

    32 of these, and here they are:

    auto const double float int short struct unsigned

    break continue else for long signed switch void

    case default enum goto register sizeof typedef volatile

    char do extern if return static union while

    There are another 30 reserved words that were not in C, are

    therefore new to C++, and here they are:

    asm dynamic_cast namespace reinterpret_cast try

    bool explicit

    For Reference : http://comsciguide.blogspot.com/

  • export new static_cast typeid

    catch false operator template using

    class friend private this typename

    const_cast inline public throw virtual

    delete mutable protected true wchar_t

    The following 11 C++ reserved words have been added to

    provide more readable alternatives for some of the C++ operators, but

    they are not essential when the standard ASCII character set is being used.

    and bitand compl not_eq or_eq xor_eq

    and_eq bitor not or xor

    Predefined Identifiers :

    Here is a very short list of some of the predefined identifiers :

    cin endl INT_MIN iomanip main npos stdcout include INT_MAX iostream MAX_RAND NULL string

    For Reference : http://comsciguide.blogspot.com/