Why it is not giving all substring
@guptanikhil898
try to dry run your code for errors
for(int j=0;j<n;j++){
r[j]=s[i];
allsubstring(s,r,i+1,n);
cout<<r<<endl;
}
this loop first initializes r[0] as s[0] and then u call the function again w recursion where i=1 and j=0 so now it replaces r[0] with s[1]
you are not moving forward this way
try to correct that