What Are Tokens, Identifiers, & keywords In C Language - Passionate Geekz

Breaking

Where you can unleash your inner geek.

Monday, 25 March 2019

What Are Tokens, Identifiers, & keywords In C Language

The syntax of the C language has been followed by many other popular languages, so understanding C is very important for you. A C program is made up of tokens. If you learn to use all the tokens in the C language, then you will become a C language expert.

For example, look at the program below. This program is used in the correct order of tokens and nothing but this.

Tokens are of 6 types. Their list is given below.

  • Identifiers
  • Keywords
  • Constants
  • Variables
  • Strings
  • Operators

Also Read

[su_posts template=”templates/list-loop.php” posts_per_page=”5″ tax_term=”1834″ order=”desc”]

If you look at this list, then in the above program, int, main, printf, + and software programming is cool etc. everything is tokens only.

Not just about all these tokens, just being told about identifiers and keywords in this tutorial. You will be told in the next tutorials about the rest of the tokens.

C Character Set

In the C language you write in the sequence of a program characters. Such as #include <stdio.h>. This statement is made up of characters only. This statement contains i, n, c, l and h etc.

But it is not that you can use any character in a C program. For this, character set has been defined by C. Only characters in this set can be used in a C program.

Alphabet in C

In Alphabet characters you can use Z from the capital case and a from z small case characters.

Digits in C

In Digits you can use any digit from 0 to 9.

Special Characters In C

In the special characters you can use the characters given below.

! @ # $% ^ & * () _ – + = | {} [] <> “, /

Apart from these alphabets, digits and special characters, you and any other characters can not be used in the C language. This is called the character set of C.

Identifiers In C

[su_youtube_advanced url=”https://www.youtube.com/watch?v=KnePsFlVvys”]

Identifiers are those names that give you variables, constants and functions. There are some rules to give to these names that you follow. If you do not follow these rules then there is an error in the program.

  • In Identifiers @,%, – characters can not be used.C is case sensitive.
  • age and age will be called two different identifiers.
  • In identifiers you can not use operators.
  • You can either start an Identifier with either a character or underscore. Digits can not be started from identifiers.
  • You can start identifiers from A to Z, both with both small and capital letters or underscore.
  • After this you can use digits and other characters or underscore.

Keywords in  C

[su_youtube_advanced url=”https://www.youtube.com/watch?v=vSezcOvHIDs”]

Keywords are also called predefined tokens or reserved words. C language provides 32 keywords. Every keyword has a special meaning. Every keyword has been defined to perform a specific task.

These keywords are not being explained right now. You will learn about these slowly in the tutorials that are coming up.

No comments:

Post a Comment