Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Industrial programming >> C Language

C Tokens, Identifiers, and Keywords: Understanding Tokens and Their Types

What Is a Character Set?

Like any programming language, C has its own character set. A C program is a sequence of instructions that manipulate data composed of characters and symbols. The compiler ignores most formatting characters, but they are essential for human readability.

The C character set is divided into four groups:

Below is a comprehensive list of the special characters used in C:

Special CharacterDescription
,Comma
{Opening curly bracket
.Period
}Closing curly bracket
;Semicolon
[Left bracket
:Colon
]Right bracket
?Question mark
(Opening parenthesis
'Apostrophe
)Closing parenthesis
"Double quotation mark
&Ampersand
!Exclamation mark
^Caret
|Vertical bar
+Addition
/Forward slash
-Subtraction
\Backward slash
*Multiplication
~Tilde
/Division
_Underscore
>Greater‑than / closing angle bracket
$Dollar sign
<Less‑than / opening angle bracket
%Percentage sign
#Hash sign

What Is a Token in C?

A token is the smallest meaningful unit that the C compiler recognizes. During lexical analysis, the source code is broken down into tokens before parsing and code generation. C tokens fall into six categories:

C Tokens, Identifiers, and Keywords: Understanding Tokens and Their Types

Keywords and Identifiers

Every word in C is either a keyword or an identifier. Keywords are reserved, have fixed meaning, and cannot be reused for naming. Identifiers are user‑defined names for variables, functions, types, and more.

Keywords in C

There are 32 keywords in the C language, all written in lowercase. They are listed below in a tidy table for quick reference:

C Keywords
autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
constshortfloatunsigned
continueforsignedvoid
defaultgotosizeofvolatile
doifstaticwhile

Identifiers

An identifier is the name you give to a variable, function, structure, enum, etc. The C standard imposes several rules on identifiers:

  1. The first character must be a letter (A‑Z, a‑z) or an underscore (_).
  2. Subsequent characters may be letters, digits (0‑9), or underscores.
  3. Identifiers cannot be any of the 32 keywords.
  4. They must not contain whitespace.
  5. While not enforced by the compiler, meaningful names improve code readability and maintainability.

Summary


C Language

  1. Interrupts Explained: Types, Mechanisms, and Applications in Modern Computing
  2. Understanding C# Keywords and Identifiers: Rules, Lists, and Best Practices
  3. C Keywords & Identifiers: A Practical Guide
  4. 3D Printing Explained: Types, Processes, and How It Works
  5. Honing: Process, Parameters, Types, and Key Advantages for Superior Surface Finish
  6. Reamer Tools: Types, Terminology, and Practical Uses
  7. Conveyor Systems Explained: Types, Applications, and Benefits (PDF Included)
  8. Understanding Casting Patterns: Types, Benefits, and Color Schemes
  9. Industrial Automation Explained: Types & Benefits for Smart Factories
  10. Lathe Machines Explained: Components, Operations, and Types – Free PDF Guide