2 Questions about C++ UE4

Hi , my first question is how can i set a default value for a TArray as a parameter function

eg ( void MyFunction( int a, int b, int c = 1, TArray myArray = ???)

and i want to know why i cant do this:

"
return UIObjects[idx];

"

i have to do this

"
UButton but;
but =UIObjects[i];
return but;
"

void MyFunction( int32 a, int32 b, int32 c = 1, TArray myArray = TArray())

should work, that creates an empty array. We usually pass TArrays as const refs to avoid having to do the copying, so

void MyFunction( int32 a, int32 b, int32 c = 1, const TArray<int32>& myArray = TArray<int32>())

is probably the best option.

I don’t understand your second question. What type is UIObjects and what type are you trying to return from the function

yeah, it says error c2220

yeah, it says error c2220