Token's in C Language 




Character Set:-

Set of Characters are referred to as set is group as follows.

1. Letters - A to Z (or) a to z

2. Digits - 0 to 9

3. Special Characters - {. , ; : ' " { }+ - * % / \ ( ) ^ }

4. White spaces - tab [5 space]

Token in C Language :

Token in C, C Tokenizer


The smallest individual unit in the program is called token. Which are defined whole program. Before you writing program we need know about Tokens. The set of tokens are Keywords, Variable, Constant and Operator.

Keyword in Token:-

Keyword is the first part of Token in C language. Keyword is predefined special meanings. Each keyword used separate purpose such as allocating storage for numeric, fractions, characters and strings.

Ex:- int, float, double, char, string

  • char => 1 byte
  • int => 2 byte 
  • float => 4 byte
  • string => 4 byte
  • double => 8 byte  

Variable in Token :-

Variables are user defined Token in C. Variable is a data name that maybe used to store a data value for easy to retrieved. A variable declaration consists data type followed by a list of one or more variables and that are separated by comma's

Syntax:-

<data type> Variable name;

Ex: int a;

Constant in Token:-

A constant is an entity whose value does not change during program execution. Constants allocated once when program started. Much favorable one in Token in C is Constant.

Ex:- int a=10;

Two types of constant and that are

(1) Numeric constant

->Interger
->Real

(2) Character Constant

->Char
->String

Integer Constant:-

It contains sequence of digits that may or may not predefined with a minus sign. Mostly we used integer constant. Integer constant is easy to calculated values and its store smaller amount of storage.

Ex: 14, -12

Real Constant:-

It can be represent into decimal. Fractional calculations are done by real constant only. Real constant values are represent by float keywords in Token in C.

Ex: 12.43

Character Constant:-

It contain single character enclose with in a pair of single quotes. Character constants are used for specify some character fixed. Which is used for Yes or No questions such ah input as Y/N.

Ex: 'k' , 'X'



String Constant:-

A string Constant is a group of character enclosed in double quotation. These are characters or any special characters. Most often use string constant. We use maximum input from users  by string only for storing user's detail such as user name, password. name and their detail.

Ex: "Welcome", "1928"

char[10] = "Welcome";

String constant Mostly used in program. Best way of explian some important msg for users. String Constant is best one at Token in C






Still doubt then you can see below video. If you like this post then share post or leave comment your suggestion

 

Post a Comment

Blogger