Largest number from given array

#include
#include<bits/stdc++.h>
using namespace std;

int mycompare(string X, string Y)
{
// first append Y at the end of X
string XY = X.append(Y);

// then append X at the end of Y 
string YX = Y.append(X); 

// Now see which of the two formed numbers is greater 
return XY.compare(YX) > 0 ? 1: 0; 

}

int main() {

int t;
cin>>t;

while(t>0)
{
	int n;
	cin>>n;

	int arr[n];

	for(int i=0;i<n;i++)
	{
		cin>>arr[n];
	}

	sort(arr[0],arr[n-1],mycompare);

	for(int i=0;i<n;i++)
	{
		cout<<arr[i];
	}
}
return 0;

}

Please let me know the mistake

Hey @arsh_goyal you were committing basic syntax errors ,here is your corrected code


If your doubt is resolved ,please mark it as resolved

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.