CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

String Indexing and Length

C++ code walkthrough · Question 30
easyStrings

Code

Read carefully. What does this print?
1#include <iostream>
2#include <string>
3using namespace std;
4int main() {
5 string s = "Hello";
6 cout << s[0] << s[4] << " " << s.length() << endl;
7 return 0;
8}

Your answer