String Constants
A string constant is a series of characters enclosed inside a pair of double quotes. The string constant might also involve numbers, special characters and blank spaces.
Example
" Hello!"
" I'm going for shopping today. Shall you come?" " 549, The Mall, Shimla."
" 4321-1234" " O"
String constant "O" differs from the character constant 'O'. The string constant does not have an integer value such as a character constant has. A string constant is always followed through a null character ('\0').
The following program will accept your name, address and phone number as string constants and show them: -
#include <iostream.h>
void main(void)
{
cout<<" Name: Rajeev\n";
cout<<" Address: 549, ABIDS, Hyderabad\n";
cout<<" Contact: 040-211717\n";
}
The output is:
Name: Rajeev
Address: 549, ABIDS, Hyderabad
Contact: 040-211717