Strings Stoi function error

can you tell what is wrong with this code?
#include
bool compare(int a, int b)
{int i=0;
string q=to_string(a);
string w=to_string(b);
while(q[i]!=NULL && w[i]!=NULL)
{int e=stoi(&q[i]);
int r=stoi(&w[i]);
if(e>r)
{return true;}
i++;
}
return false;
}

string Solution::largestNumber(const vector &A) {
int n=A.size();

sort(A.begin(), A.end(), compare);
string s;
int i;

for(i=0;i<n;i++)
{
s=s+to_string(A[i]);

}
return s;

}
it is the part of a question.

@Eshika you can use the inbuilt stoi() and to_string() functions.
Please save your code on ide.codingblocks.com and share the link, for any further queries. Mark your doubt as resolved if I have cleared your doubt.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.