Introduction to String programming in C++

When we declare an array we take the number to declare them but string is the way to declare the array of characters. By using this we can store the string values inside them. A string is known as an array of characters. String literals are words surrounded by double quotation marks.

For example: "Welcome to Smart Code for You" is a string literal.
If we want to declare the string of 15 characters then we can declare like String abc[16]. A string ends with a null character, literally a '\0' character. There will be an extra character on the end on a string. It is like a period at the end of a sentence, it is not counted as a letter, but it still takes up a space. 
In C++, strings are not a built-in data type, but rather a Standard Library facility. Strings can be declared in two main ways. One of these is as an array of characters and the other is as a pointer to some preassigned array.

Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: