Boolean Literals Boolean literals are used to represent one of the Boolean values (True or false). Internally true has value and false has value . Character constant A character constant in C++ is any valid single character enclosed within single quotes. Valid character constants : ‘A’, ‘ ’, ‘$’ Invalid character constants : “A” The value of a single character constant has an equivalent ASCII value.
For example, the value of ‘A’ is . Escape sequences (or) Non-graphic characters C++ allows certain non-printable characters represented as character constants. Non-printable characters are also called as non-graphic characters. Non-printable characters are those characters that cannot be typed directly from a keyboard during the execution of a program in C++, for example: backspace, tabs etc.
These non-printable characters can be represented by using escape sequences. An escape sequence is represented by a backslash followed by one or two characters. Chapter Page - - Table . Escape Sequences Escape sequence Non-graphical character \a Audible or alert bell \b Backspace \f Form feed \n Newline or linefeed \r Carriage return \t Horizontal tab \v Vertical tab \\ Backslash \’ Single quote \” Double quote \?
Question Mark \On Octal number \xHn Hexadecimal number \ Null Even though an escape sequence contains two characters, they should be enclosed within single quotes because, C++ consider escape sequences as character constants and allocates one byte in ASCII representation. ASCII (American Standard Code for Information Interchange) was first developed and published in by the X3 committee, a part of the American Standards Association (ASA). . What is meant by literals?
How many types of integer literals are available in C++? . What kind of constants are following? i) ii) iii) 0xF iv) .
. What is character constant in C++? . How are non graphic characters represented in C++?
. Write the following real constants into exponent form: i) . ii) . iii) .00007 .
Write the following real constants in fractional form: i) .23E4 ii) .517E- iii) .5E- .