Skip to main content

TOKENS IN C++

Tokens -
              Tokens are the smallest individual unit of a program . C++ generally has following tokens
                                           1] Keyword
                                           2] Identifiers
                                           3] Literals
                                           4] Punctuators
                                           5] Operators
1] Keywords -
                      keywords are the words that convey special meaning to the language compiler they are also known as reserved words few examples of keywords are - asm ,auto ,if, else, etc

2] Identifiers -
                       identifiers are the fundamental building blocks of a program and are used as a General terminology for the names of a different parts  .there are several rules for writing an identifier as
                           a]  an identifier must be started with an alphabet or an underscore.
                           b]  blanks are not allowed.
                           c]  special symbols are not allowed.

examples of a valid identifier in C++ are -   my_files ,saucom99 , Saurabh , A5 , _ABC

3] literals -
                   literals are often referred to as a constant and are the data items that never changes their value during the program execution .there are following types of literals in C++
                           a] Numeric constant
                           b] Character constant
                           c] String constant
                           d] Bool constant

a] Numeric constant -
                                  a numeric constant must have at least one digit and must contain one decimal. It may contain plus or minus sign a number with no sign is assumed to be positive commas cannot appear in between.

b] Character constant  -
                                character constant is written within a single quotes and its size is One byte that means it contains single digit or single character.

Popular posts from this blog

INTRODUCTION

C++ (pronounced as "see plus plus") is a computer programming language based on C. It was created for writing programs for many different purposes. In the 1980's, C++ became one of the most used programming languages in the world. The C++ programming language was developed by Bjarne Stroustrup at Bell Labs in the 1980s , and was originally named "C with classes" by   rick mascitti . The language was planed as an improvement on the C programming Language ,adding features based on object oriented programming. Step by step , a lot of advanced features were added to the language ,like operator overloading ,  exception handling and templates .