"Z Code Writer" is an Online Blog for Programmer & Beginner. Here, You will Find tech, Build your Programming Skills and other Programming Language Like C, C++, HTML, Java Script Java Code, Web Designing and University Of Sialkot (USKT) CGPA / GPA Calculator etc.

Saturday, 29 June 2019

Character Set of C / C++, Keyword, Token, Identifiers and their types

Character Set Of C / C++ 

     Every of the programming language has a set of characters. These characters are used to write the statements of the program. In C- language also a program is written by using a set of characters. These characters are known as alphabet or character set of C.
   * Lowercase letters: a,b,c,..........,z
   * Uppercase letters: A,B,C,..........,Z
   * Digits: 0,1,2,..........,9
   * Special character: +,-,=,(,),{,},<,>,',",!,@,#,$,%,/,\,:,?
   * White space, blanks, new line, tab etc.

Keyword

      The predefined words of the c-language that are used for special purpose in the source program are called Keyword. Keyword are also called reserved words. For example keyword "int" is used to define integer type variable.
      Each keyword has certain meaning in C-language. They cannot be redefined or used in other ways and also don't used variable or function names. Keyword always written in lowercases. They are 32 keywords in C / C++.

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

Token

      In C-language, a source program consists of keywords, variables (or Identifiers), constant, operator, punctuation etc. These elements of s program are known as tokens. For example,
     
     main()
     {
     float temp, xyz9;
     xyz9 =29;
     temp = xyz9 + 100 * 5;
     } 

In the above program:
   * "main" is a special identifier and temp, xyz9 are variables.
   * "float" is a keyword.
   * The punctuation are; "{", ", "," "(", ")", ";", white space etc.
   * The operators are : "=", "*", "+" etc.

Identifiers

      The unique names used in the program to represent the variable, constants, function and labels etc. are called identifiers. In C-language the name of an identifier may consist of 31 characters.

Types of Identifiers 

      i.  Standard identifier.
      ii. User-defined identifier.

i)  Standard identifier

      Like keyword, there are also predefined identifier in C. The predefined identifiers that are used for special purposes in the source program are called standard identifier. For example, in C program the scand() and printf() and C++ cout and cin function are mostly used for input and output operator.

ii.) User-defined identifier

        The user (or programmer) can define its own identifiers in C / C++ program such as variables and user-defined function. The identifiers defined by the user in the program are called user-defined identifier.

No comments:

Post a Comment

Thanks For Visiting Here...!! I will Reply you as soon as possible.