1.    1. Character Set

A set of valid character that a language recognises any letter symbol. A character denotes any alphabet, digit or special symbol used to represent information.        

Alphabet  -  A-Z  ,  a-z

Digit  -  0-9

Symbol  !  @  #  $  %  ^  ()  {} []  ; , . > < ? / * etc.

White space     enter    backspace     tab

 

2.    2. Token

The smallest individual unit of a program is called token.

 

 Types of Token

1.   Keywords

2.   Identifiers

3.   Constant

4.   String Constant

5.   Special Symbol

6.   Operator

 

2.1   Keywords

These are words whose meaning and use is predefined or predecided.

For example-

 

asm

else

new

this

auto

enum

operator

throw

bool

explicit

Private

true

break

export

protected

try

case

extern

public

typedef

catch

false

register

typeid

char

float

reinterpret_cast

typename

class

for

return

union

const

friend

short

unsigned

const_cast

goto

signed

using

continue

if

sizeof

virtual

default

inline

static

void

do

long

struct

wchar_t

double

mutable

switch

while

dynamic_cast

namespace

template

 

 

2.2   Identifiers

An identifiers is a name given by a user to a unit of a program element name it can be variable name, function name, class name, array name, structure name etc.


Rules of identifiers are

1.  Length is must be 1-31 character

2.  Only alphabet digit & underscore is used.

3.  First character must be an alphabet or an underscore

4.  Name can’t start with digit

5.  Keywords can’t be used

6.  Space & symbol are not allowed

7.  Upper case and lower case are different

Example -  Roll_no   , BK_17 , _1ab ,_ab1 etc.

 

2.3   Constant

These are the data item that never change the value during the program execution. It is 3 type

 

1. Integer Constant

An integer is a whole number without any faction part it can be +ve and –ve and default sign is +ve.

Example - 15      -33      +884

 

2. Floating point/Real Constant

It is also known as real constant. It must have a decimal value it must be +ve and –ve .It has two forms-

Fractional form - 2.0   17.50 etc.

Exponential  form  200000 - 2.0e5

 

3. Character Constant

It is single alphabet or a digit or a symbol in a single inverted comma.

Example ‘a’  ‘1’   ‘@’ etc.

 

2.4    String Constant

A string constant is a sequence of character in a double quotation mark.

Example “hanuman”  “123456789”   “#$%^&*()_+” etc.

 

         2.5   Special Symbol

Special symbol are -   ()  , {} , [] , . , , , / , \ , : , ; , ! , | etc.


3.  Printf

 

Printf is an inbuilt library function in c which is available in c library by default. This function is declared and related macros are defined in “stdio.h” header file. Printf function is used to print the character, string,

Float, integer, octal and hexadecimal values onto the output screen.


Example of Printf

#include<iostream.h>

#include<conio.h>

void main(){

            clrscr();

            cout<< ,cout<<"Hello" ,cout<<"Bye";

getch();

}

Output

        ByeHello53