Home » C++ Programming » Strings » Question
  1. What is the output of this program?
    #include <iostream>
    #include <string>
    using namespace std;
    int main ()
    {
    string s ("Interview Mania");
    cout << s.capacity();
    cout << s.max_size();
    return 0;
    }
    1. Interview Mania
    2. 159223372036854775807
    3. Compilation Error
    4. 6 and max size depends on compiler
    5. None of these
Correct Option: D

In this program, We are printing the capacity and max size of the string.



Your comments will be displayed only after manual approval.