My Blog
Articles related to programming, computer science, technology and research.

22/04/2016 Categories: C Programming. No Comments on C Tokens

Introduction

A programming language is designed to help process certain kinds of data consisting of numbers, characters and strings and to provide useful output known as information. The task of processing data is achieved by writing instructions. These set of instructions is known as a program. Programs are written using words and symbols according to the rigid rules of the programming language known as syntax.

 

Character Set

The characters that can be used to form words, numbers and expressions depend upon the computer on which the program is run. The characters in C, are grouped into the following four categories:

1) Letters

2) Digits

3) Special Characters

4) Whitespaces

The compiler ignores the white spaces unless they are part of the string constants. White spaces are used to separate words from each other, but they cannot be used in between the characters of keywords and identifiers.

 

C Tokens

In a paragraph of text, individual words and punctuation marks are considered as tokens. Likewise in a C program, the smallest individual units are known as C tokens. C has six types of tokens as shown below. C programs are written using these tokens and the syntax of the language.

c-tokens

Keywords

Every word used in a C program is classified as either a keyword or as an identifier. A keyword in C is a reserved word which has a specific meaning. Keywords in C cannot be used as identifiers. Keywords serve as the basic building blocks for program statements. Keywords in C are always in lowercase. ANSI C supports 32 keywords which are listed below:

c-keywords

Identifiers

Identifiers refer to the names of variables, functions and arrays. These are user-defined names and consist of sequence of letters and digits, with a letter as a first character. Both uppercase and lowercase letters can be used, although lowercase letters are generally used. The underscore character is also permitted in identifiers. There certain rules while writing identifiers. They are as follows:

1) First character must be an alphabet or underscore.

2) Must consist of only letters, digits or underscore.

3) Only first 31 characters are significant.

4) Cannot use a keyword.

5) Must not contain white space.

Suryateja Pericherla

Suryateja Pericherla

Hello, I am Suryateja Pericherla working as an Asst. Professor in CSE department at Vishnu Institute of Technology. I write articles to share my knowledge and make people knowledgeable regarding certain topics.
Suryateja Pericherla

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up
Thank you for visiting startertutorials.com! If you like this website do share with your friends by clicking on the social icons available on the left hand side.

As the domain name is quite large to remember, use this short domain to visit this site. Short domain: stuts.me