×

C Token

C Token and Keyword

The C tokens are the basic buildings blocks in language which are constructed together to write a C program. Each and every smallest individual unit in the program is known as C Tokens. 
 

There are six types of tokens in the C language that are given below:
  1. Keywords
  2. Identifier
  3. Constant
  4. String
  5. Operator
  6. Punctuation
Lets us consider an example of Token.

explain c tokens

Keywords in C
The keyword is used to perform an internal operation. We cannot use it as the variable name, constant name, etc. Every keyword exists in lower case latter like auto, break, case, etc. There are 32 keywords in C language.

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

Identifiers in C
The identifier is a name used to identify variables, constants, functions, and user-defined data. There are following some rules for naming identifier.
  • It can only alphanumeric characters (a-z, A-Z, 0-9) and underscore ( _) symbol.
  • Identifier names must be unique.
  • The first character names must be unique.
  • We cannot use a keyword as identifiers.
  • Only first thirty-one (31) characters are significant.
  • Must not contain white spaces.
  • Identifiers are case-sensitive.
Example:
int amount;
double totalbalance;
In the given above example amount and total balance are identifiers and double is a keyword.

Constant in C
Constant is a variable that value never changes during execution once defined. It is also known as literals. Const keyword is used to define a constant. 

explain c tokens in detail 

Syntax:
const type constant_name;
Example:
constint ID =10;
12-11-17
Strings in C
String constants are the sequence of characters enclosed within double quotes. Every string constant is automatically terminated with a special character called the null character which represents the end of the string.

Example:
char =“hello”
char= ‘A’;
char string[10]={‘s’,’t’,’r’,’i’,’n’,’g’,'0'};
char string[]=“tutorialandexample”;

Related Topics

Fibonacci series in C

We have learned about the Fibonacci series in mathematics. For a quick recap, A Fibonacci series is the sequence of numbers following a certain pattern i.e., the next number should...

3 minutes read.

Flexible Array Members in a Structure in C

There is flexibility to declare array from c99 generation onwards that declaration of the collections can be made possible without even mentioning its dimension, which means that the displays are...

4 minutes read.

Math functions in C

Math functions in C: In the C programming language, the compiler allows the developer to perform mathematical operations through the header’s functions, represented by <math.h>. The <math.h> header defines various mathematical...

3 minutes read.

Reverse a Stack using Recursion in C

In this tutorial we will learn how recursion will be used in this case to reverse a stack. For loops, while loops, do-while loops, and similar constructions are not permitted....

5 minutes read.

Formatted Input and output function in C

Formatted I/O functions display multiple outputs to the user by taking various inputs. All data types like int, float, char and double are supported by the formatted I/O function. In...

4 minutes read.

What are linker and loader in C

Linker and loader are utility programs that have a significant role in executing a program. Linker: A linker is a program that joins the object files produced by the assembler/ compiler...

3 minutes read.

Entry Control Loop in C

Initially, an entry control loop verifies the termination condition at the entry point. After that, its control passes to the main body of the while or for loop if the...

3 minutes read.

How to install a C compiler in windows 10-64bit

Many C compilers can be installed on your pc. The most downloaded compilers include GCC, Turbo C++, Visual Studio, etc. This article includes the installation of the Turbo C++ compiler in...

6 minutes read.

Bit Fields in C

The size of a structure in C is specified in bits. The primary goal of it is to use memory efficiently, once we understand that a bit's value must fall...

3 minutes read.

Multiplication table program in C using For loop

Before we move on the program of multiplication table of any natural number, first we have to know about the For loop statement. The syntax of ‘for’ loop in C programming...

3 minutes read.

How to convert a number to words in C

There are many ways available for converting an integer or a number to its word form. For example, consider a number as 12345. This number can be represented in two...

3 minutes read.

Difference between C and Java

C programming and Java programming are two of the earliest programming languages. C programming follows a procedural approach whereas Java programming follows an object-oriented approach. Java programming is a part...

3 minutes read.

Calloc in C

The calloc() is a library function in C which is used for memory allocation. The calloc() function dynamically allocates multiple blocks of memory to complex data structures. This includes data structures...

3 minutes read.

Built-in functions in C

The function is a set of instructions and statements enclosed in the "{}" delimiter. In c, there are two types of functions. Pre-define functions/ Built-in functionsUser define function. Built-in functions in C:- These...

8 minutes read.

Fibonacci Series in C Using For Loop

In this C article, we will let you know about the procedure of displaying the Fibonacci series of the first “n” positive integers. The syntax of for loop used in the...

4 minutes read.

C and C++ Binary Files

What is a binary file? A file in which the content is written in binary format is called a binary file. A binary file is not a text file. There are...

7 minutes read.

Bank management system in C

This is a mini project that is constructed completely using the C language. The bank management system is a beginner friendly project. To construct this user only needs to know...

12 minutes read.

2f in C language

Float data type in c: Double-precision floating-point numbers with up to 17 significant digits are stored in the FLOAT data type. FLOAT is equivalent to C's double data type and IEEE...

3 minutes read.

Enumeration (Enum) in C

Enumeration (Enum) in C: In the C programming language, the enum is referred to as an enumerated type. Enum is a user defined data type consisting of integer values and...

3 minutes read.

Round Robin Scheduling in C

Round Robin Scheduling in C Round robin is a CPU (Central Processing Unit) scheduling algorithm designed to share the time systems. It is one of the simplest and easiest scheduling algorithms...

4 minutes read.