saving . . . saved Regarding String Variable has been deleted. Regarding String Variable has been hidden .
Regarding String Variable
Title
Question
In the program, I couldn't understand the usage of 'string variable' instead of 'char'. Kindly please explain.

C-and-Cpp Strings 07-08 min 50-60 sec 05-09-21, 3:10 p.m. srishtipramanic7@gmail.com

Answers:

Any string is made up of characters.
Consider a statement in C:  
char name[size];
In the above statement, you declare a character array 'name' of a certain size 'size', which can be used to store a set of characters.
In c++, we do the same thing but in a slightly different way. C++ has a ready made construct for  storing strings using a 'string' class.  
We do not need to declare the size as it is declared by the class itself.
So, we can just use the following:
string strname;

Hope this answers your question

Thanks

Spoken Tutorial Team
15-09-21, 1:37 p.m. nags
Thanks for the explanation.
15-09-21, 4:40 p.m. srishtipramanic7@gmail.com

Login to add comment


Log-in to answer to this question.