Important point about String in C++ programming:
1. What is a string?
A string is a sequence of one or more characters.
2. Write the syntax for declaration of a string.
syntax: char array_name [size]; Ex: char str [100];
3. State the difference between a null character and a null sting.
A null character indicates the end of the string.
A null string is a string with zero characters or no characters.
4. Which header file is needed to perform string operation?
#include<string.h>
5. Which header file is needed to perform character operations?
#include<ctype.h>
6. Write an example for string initialization.
char str[100] ={“CHANDIGARH CITY”};
7. What is the difference between gets() and scanf() function?
gets() function receives a string input up to the end of the line or a new line character. This means the string may have blank spaces and punctuation.
Scanf() function accepts a string only up to the first blank space or punctuation.
Thanks
Mukesh Rajput
Post A Comment:
0 comments: