CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #30

String Indexing and Length

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