Monday, October 27

What are character constants ?


Hello everybody lets move further some what to the basics of programming with C++ i.e character constants.
A character represented within single quotes denotes a character constant.
Here are some examples of it….
‘A’
‘a’
‘:’
‘?’ etc…

Character data type>> Any character belonging to the ASCII character set is considered as a character data type whose maximum size is 8 bits long.
The char is a keyword to represent the character data type in C++.
Character constants are always represented within single quotes.
Plain char, signed char and unsigned char are three distinct types.
A char, a signed char and an unsigned char occupy the same amount of memory space.
The classification of the char data type is dependent on the version of the C++ compiler.

Declaration of the character constants…
char x;
char x,y,z;

The char stands for the character data for declaring the character constants.
The declaration format of character data type is same as that of the declaration of the integer, floating or string constants.
The backslash(\) is used to denote non-graphic characters and other special characters for specific operations.
The following characters are used as non-graphic characters:

‘\a’>> alert a bell character
‘\n’>> new line
‘\t’>> horizontal tab
‘\b’>> backspace
‘\r’>> carriage return
‘\f’>> form feed
‘\v’>> vertical tab
‘\\’>> backslash
‘\’’>> single quote
‘\0’>> null character
‘\?’>> question mark
‘\000’>> octal value
‘\xhh’>> hexadecimal value
Thanks for now do come tomorrow for some of the nice and really important topics…….

0 comments:

Followers

Archive

 

Money ,Entertainment and Education. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com