C++ Escape sequence characters and Comments


Escape Sequence Characters (Backslash Character Constants) in C++:


C++ supports some special escape sequence characters that are used to do special tasks.

These are also called as 'Backslash characters'.

Some of the escape sequence characters are as follow:


Character--------- Constant Meaning

\n----------------- New line (Line break)
\b----------------- Backspace
\t ----------------- Horizontal Tab
\f ------------------Form feed
\a ----------------- Alert (alerts a bell)
\r ----------------- Carriage Return
\v ----------------- Vertical Tab
\? ----------------- Question Mark
\' ------------------ Single Quote
\'' ------------------ Double Quote
\\ ------------------Backslash
\0------------------Null


Comments


There are two types of comments

1. // (Single Line Comment)

Any line that starts with a // is a comment

eg : clrscr(); // to clear the screen

2. /* (Multiple Line Comment)

*/

Example :

/*

Program To Display

Welcome Message On The Screen

*/

Comments Statements are not executable statements.

Comments are used for user help.



     Prev                                                   NEXT

0 comments:

Post a Comment