Why is the size of the temp string 0 even after running the loop to copy characters from s? I get 0 as the size of the temp string.
#include <iostream>
#include<string>
using namespace std;
string CopyString(string s,int delta,int len){
string temp;
int i;
for (i = 0; i < len; i++)
{
temp[i] = s[i + delta];
}
cout<<temp.size();
return temp;
}
int main() {
string s = "Hello";
cout<<CopyString(s,2,5);
}