Tokens, Keywords, and Identifiers in C Programming Language

In this article, Today we will Learn What is Tokens, Keywords, and Identifiers in C Programming Language. In this post, I am going to answer some such questions related to “Tokens, Keywords, and Identifiers.” I hope you get your answer.

Tokens in C Programming

As we know that tokens in C programming Language are called basic building blocks which each small unit in C program is known as C token. In simple words, a complete program is created with the help of tokens. Every small part used in the program is called tokens.

We can also call a C program a collection of different tokens for easy understanding. Therefore it is essential to learn tokens in the correct order because many other popular programming languages have followed the syntax of C, such as C ++, Java, etc. Therefore it is essential to understand the syntax of the C programming language. Look at the C program given below, how we have used the C token in the correct order.

Tokens, Keywords, and Identifiers in C Programming Language
#include <stdio.h>
#include <conio.h>
int main()
{
   int x, y, total;
   x = 10, y = 20;
   total = x + y;
   printf ("Total = %d \n", total);
}

C tokens are of the following types:

  • Keywords (eg: int, while)
  • Identifiers (eg: main, total)
  • Constants (eg: 10, 20)
  • Strings (eg: “total”, “hello”)
  • Special Symbols (eg: (), {})
  • Operators (eg: +, /,-,*)

Keywords In C Programming Language

Keywords are Predefined, Reserved Words, meaning already explained by the compiler. This means that when designing a C language, some words would be reserved to perform specific tasks. Are. Such words are called keyword (or) reserved words. All C compilers support 32 keywords. The C programming language consists of 32 keywords in total.

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

What is Identifiers In C Programming

Identifiers are a sequence of alphabets and digits, but keywords are not used as identifiers. In C programming, the name was given to the variable, function, structure, union, etc. created by the programmer using a combination of the identifiers alphabet (A to Z (or) a to z), digits: (0 to 9), underscore (_). Happen. There are two types of identifiers “Variable” and “Constant”. The following are some rules that you should follow when declaring names to identifiers.

int money;
double accountBalance;

Here, money and account balance are identifiers.

  • The first character must be an alphabet or underscore.
  • Alphabet (a to z), digits (0 to 9), and underscore (_) are to be used.
  • Punctuation and special characters are not permitted except underscores.
  • Identifiers are case sensitive in C programming. For example, age and AGE are two separate identifiers.
  • Identifiers must not be keywords.

Conclusion

If you like This Article Tokens, Keywords, and Identifiers in C Programming then Give him a Feedback In Comments.

Follow aCodiz me on Social Media Platform

and also share Knowledge With Your Friends…

Thanks and Read Our Other Articles:

2 COMMENTS

  1. Hey are using WordPress for your blog platform?
    I’m new to the blog world but I’m trying to
    get started and set up my own. Do you need any html coding expertise to make your own blog?
    Any help would be really appreciated!

LEAVE A REPLY

Please enter your comment!
Please enter your name here