#include<bits/stdc++.h>
using namespace std;
int main ()
{
string str="appleap",str1;
for(int i=0;i<str.size();i++)
str1[i]=str[i];
cout<<"xxxxxx "<<str1<<endl;
cout<<str1[0]<<str1[1]<<str1[2]<<str1[3]<<str1[4]<<str1[5]<<str1[6]<<endl;
}
Output is :
xxxxxx
appleap
why is str1 not printing after "xxxxxx" but why it is printing when access str1 character by character?
can anyone help me?