Embed presentation
Download to read offline






![C++ Access Strings
Access Strings
You can access the characters in a string by referring to its index number inside
square brackets [].
This example prints the first character in myString:](https://image.slidesharecdn.com/cnumbersandstrings-221107035407-5d49648d/75/C-Numbers-and-Strings-pptx-7-2048.jpg)
![Access String
Note: String indexes start with 0: [0] is the first character. [1] is the second
character, etc.
This example prints the second character in myString:](https://image.slidesharecdn.com/cnumbersandstrings-221107035407-5d49648d/75/C-Numbers-and-Strings-pptx-8-2048.jpg)

C++ allows adding numbers and concatenating strings by adding them. If a number and string are added, an error occurs. The length of a string can be obtained using the length() or size() function, which provide the same result. Individual characters in a string can be accessed or changed by referring to their index number within square brackets, with the first character at index 0.






![C++ Access Strings
Access Strings
You can access the characters in a string by referring to its index number inside
square brackets [].
This example prints the first character in myString:](https://image.slidesharecdn.com/cnumbersandstrings-221107035407-5d49648d/75/C-Numbers-and-Strings-pptx-7-2048.jpg)
![Access String
Note: String indexes start with 0: [0] is the first character. [1] is the second
character, etc.
This example prints the second character in myString:](https://image.slidesharecdn.com/cnumbersandstrings-221107035407-5d49648d/75/C-Numbers-and-Strings-pptx-8-2048.jpg)
