TOKEN

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

CHAPTER 3

Constants, Variables and Data Types


■ Letters Digits
■ Uppercase A_Z All decimal digits 0..9
CHARACTER SET ■

Lowercase a_z
Special Character
■ , comma & ampersand
■ . Period * asterisk
■ The characters that can be used to form ■ ; semicolon - minus
words, numbers and expressions depend
upon the computer on which the program is ■ : colon + plus
run.
■ ? Question mark / slash
■ The characters in C are grouped into the
following categories: ■ ‘ apostrophe \backslash
■ Letters ■ “ quotation mark ~ tilde
■ Digits ■ ! Exclamation mark _ underscore
■ Special characters ■ | vertical bar % percent sign
■ White spaces ■ White Spaces
■ Blank space
■ Horizontal tab
■ Carriage return
■ New line
C Tokens
In a C program the smallest individual units are known as C tokens.

C tokens

keywords constants Strings Operators

Identifiers Special Symbols


KEYWORDS AND IDENTIFIERS
Every C word is classified as either a keyword or an identifier. All keywords have fixed meanings and these meanings
cannot be changed.

Identifiers refer to the names of variables, functions and arrays.

Some keywords

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
Rules for Identifiers
1. The first character must be an alphabet (or underscore).
2. Must consist of only letters, digits, or underscore.
3. Only the first 31 characters are significant.
4. Cannot use a keyword.
5. Must not contain white space.
CONSTANTS
Constants in C refers to fixed values that do not change during the execution of a
program.
CONSTANTS

Numeric constants Character constants

Integer Real Single character String


constants constants constants constants

You might also like