TArrayMyArray; // declare an empty TArray of integers MyArray.Add(1); // add '1' to the array MyArray.Add(2); // add '2' to the array
TArrayThis code declares two TArrays of integers. 'NewElements' is populated with the values 3 and 4, and then appended to 'MyArray' using the 'Append' function. Package/library: This code uses the Unreal Engine API, which is part of the "Unreal" package/library.MyArray; // declare an empty TArray of integers TArray NewElements; // declare a new TArray to add to MyArray NewElements.Add(3); // add '3' to the new array NewElements.Add(4); // add '4' to the new array MyArray.Append(NewElements); // add the new array to the end of MyArray