Home » C++ Programming » Strings » Question
  1. What is the output of this program?
    #include <iostream>
    #include <string>
    using namespace std;
    int main ()
    {
    string str ("Prayagraj Shakya");
    cout << str.capacity() << "\n";
    return 0;
    }
    1. Runtime Error
    2. 16
    3. Prayagraj Shakya
    4. Compilation Error
    5. None of these
Correct Option: B

In this program, We are finding the capacity that the str can hold.



Your comments will be displayed only after manual approval.