Tokens, Keywords, Identifier

In the previous chapter we have learnt about basic concept of C Data Types compilation and execution process of c etc. In this chapter we are going to learn about the Tokens, Keywords, Identifier.

“Below descriptions of Tokens, Keywords, Identifier are given one by one”.

Tokens

Tokens are small unit in C programming which are used together to construct the C program, they are of following types:

    • Keyword
    • Identifier
    • Constant
    • String
    • Operator
    • Specified Symbol

Tokens, Keywords, Identifier
C tokens example program

Here
main -> Identifier
{},() -> Delimiters
v1, v2 -> Variables
100, 200 -> Constant
main, print, {}, (), v1, v2 are the Tokens

Click here to purchase smart watch.

Keywords

Keywords are the reserved words in C used for some specific purpose. According to ANSI (American National Standards Institute) there are 32 keyword in C which are mentioned below:

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

Note : As discussed all keywords are the reserved word. So, We can’t use keywords as a variable in Programming. By mistake if will use as a variable then C compiler will generate a compile time error.

Identifier:

Keywords are predefined words that cannot be changed or altered by users while the identifiers are user defined words that are used to give names to entities like variables, arrays, functions, structure etc.
There are certain rules which need to be followed while naming identifiers

  • Name should consists of only alphabets, letters, digits and underscore.
  • First letter of identifier must be alphabet or underscore.
  • Special characters or keywords or symbols are not allowed.
  • C is case sensitive, hence uppercase and lowercase letters are considered different.

Some examples of valid identifiers:
Name, marks, net_pay etc
Some examples of invalid identifiers:
10name- first letter must be alphabet.
Float- It is a keyword,hence not valid.
Marks# – # is a special character hence not valid.

You can watch video tutorials of Quick Solution in YouTube.

Click here to download pdf of tokens, keywords, identifiers.


           

2 thoughts on “Tokens, Keywords, Identifier”

  1. Pingback: camiseta del valencia

Leave a Reply