Monday, 30 July 2012

Learning C++ :Chapter 4

CHAPTER 4 
Hello Everyone. Today I will teach you about the R-Value and L-Value OF Variables and About Escape Sequences and How to use them ?


R-Value And L-Value
R-Value refers to the content or data value of the variable whereas The L value (Location Value) represents the address or location of the variable.


Here I want to give an example: Variable A is Taken which has been assigned value 17 and It is in 2004.Here 17 is the R-Value and 2004 is L-value (also called as Location Value).


ESCAPE SEQUENCES


It is also called non-graphic characters that have special meaning for the compiler.
FEATURES:

  • It always start with the \ (slash).
  • It is only used within the double quotes.(").
  • We can only use them in cout  statements.
There are following escape sequences:
\a
It stands for audible sound.It will produce an audible sound with the help of the sound card attached in the motherboard.
\n
It stands for new-line character.As it is the feature of C++ to display all the contents in the single line so we can use \n to take the text to the next line.
\v
It stands for vertical tap.It provides vertical spaces but in the output window there will be no any difference as \v is only applicable at the time of printing.
\t 
It stands for horizontal tap.It provides few spaces in horizontal direction.
Example: " Hello                 World"
\r
It is the escape sequence that places the cursor at the begging of the line.
Example: cout<<"Welcome \r here";
Output will be  :          hereome

SO friends do try these escape sequences and if any doubt arises post it in comments or send @ ishu.hitesh@gmail.com

No comments:

Post a Comment