首页 > 文章列表 > 解释C语言中的C标记符

解释C语言中的C标记符

浮点数 字符串处理 C标记符解释 数学计算等功能。 字符等。
462 2023-08-19

Tokens are generally smallest, indivisible units in a C program with different meanings.

Types of Tokens

The various types of tokens in C are as follows −

  • Identifiers − This refers to the name of the functions, variables, arrays, structures, etc.

  • Operators − These are the symbols that tells to the C compiler to perform some logical, mathematical, or relational operations.

  • Special Characters − All characters except alphabets and digits are called special characters.

  • Constants − Some fixed values that cannot be changed during the program execution are known as constant terms

  • Keywords/Reserved Names − These are Predefined words with some special meanings that cannot be used as variable names.

Example

Following is the C program for usage of tokens −

#include<stdio.h>
int main(){
   int p, q, result;
   p = 2, q= 3;
   result = p + q;
   printf ("result = %d 

", result); }

这里,

  • main是标识符。
  • {,}, (,)是分隔符。
  • int是关键字。
  • p,q,result是标识符。
  • main, {, }, (, ), int, p, q, result一起被称为标记。