Character set | identifier and their rule | comments

Here in this, we will learn following three,

 

Character set

In practical terms, the Character set is in which we write c ++ language, which means that c++ supports.As is the updated version of c++ c, so a lot of c++ features have been taken from c in which the character set is one. That is how it is.

  • Alphabets(a-z,A-Z)
  • Digits (0-9)
  • Symbol character(_)

Because c ++ language case sensitive language, so both alphabet and lowercase are considered as different characters, meaning that c++ contains 52 alphabet (26 lowercase a-z and 26 uppercase A-Z).

 

identifier and their rules

The identifier, in the program, is the name of a variable, object, function, array, structure or class.Like a boy, place or city name is an identifier in real world

There are some rules to give the name identifier in c or c++ as follows-

  • Only alphabet character and underscore can make identifier. eg- a, a_ .
  • Can not be a special character identifier such as @, &, $, #, – ,) , ( etc.
  • Because there is no length set in Identifier, so any sentence can be an identifier such as name, address.
  • Uppercase and lowercase will be two different types of identifier such as name and Name both will be different types of identifier.
  • reserved keyword which c ++ already define you can not take them as an identifier.
  • identifier will never start with numbers. like
    9a, 6name;

 

Comments and their use

In a way, by using the comments in the programmer’s message, the program can tell you what task or code you wrote for that statement. In a way, introduce a small introduction of that statement so that when you look at that program in the future, you can easily understand what work you wrote for that statement.

Compiler does not read comments, so we can post anything in comments and its also helpful in debugging the program.

In c ++ we can write comments in two ways

  • Double slash(//) It is used mostly to give single line comments. like-
// This is comments 
//Programmer write message herself for future
  • /* Comments */ It is mostly used for multi line comments. like:-
/* This is example of multiline
Comments.
This is c++ tutorial introduction */

According to your requirement // can also be used for multiline and /*…..*/ for single line comments.


previous-Token and Keyword

next-constant and their types