Form biggest number. I have got the logic but I am having trouble to code it. Can you please look at it tell how the following will implement

Hi,
As your comparator is using strings, it’s better to use strings in all such places (take string input and sort the string array).

But the question tells us to take int array

Yes, but nothing stops you from taking integer as a string input (this is used in many cases).

The other way will be to take integer as input but store them as strings, because your comparator takes strings as arguments not integers.

Can you explain as to how can I change my integer array into string?

One more way will be to change your comparator as

bool mycompare(int aa, int bb)
{
    string a = to_string(aa), b = to_string(bb);
    string x= a.append(b);
    string y= b.append(a);
    return x.compare(y);
}

Yes, just change your array to string type.

string a[100];      // instead of int a[100];
// rest code is same as your original

So I can use this mycompare function (that you just told me) to sort an integer array?

Yes, because I changed them to strings later.

Can you check my comparator? The output is just giving me the array but reversed, whereas I am trying to form the biggest number possible.

Please provide the latest code you want me to check

de.codingblocks.com/s/315921

append adds to the original string, hence a is changed after the first append
also string::compare() is not the right way to return

change you comparator to

bool mycompare(int aa, int bb)
{
    string a = to_string(aa), b = to_string(bb);
    string x = a + b;
    string y = b + a;
    return x > y;
}