TArrayMyArray = { 1, 2, 3, 4, 5 }; MyArray.Reset(); // deallocates the memory occupied by MyArray and resets its size to zero
TArrayIn this example, we create an array of FVector (a structure in Unreal Engine 4) using the default constructor of TArray. We then add ten elements to the array using the Add function. Finally, we call the Reset function to deallocate the memory occupied by the array and reset its size to zero. The TArray class is part of the Unreal Engine 4 package library, which provides a set of classes and functions for game development.MyVectorArray; for (int i = 0; i < 10; i++) { MyVectorArray.Add(FVector(i, i, i)); } MyVectorArray.Reset(); // deallocates the memory occupied by MyVectorArray and resets its size to zero