#include#include int main() { TArray myArray = { 1, 2, 3, 4 }; myArray.Add(5); myArray.Add(6); for (int i = 0; i < myArray.Num(); i++) { std::cout << myArray[i] << " "; } // Output: 1 2 3 4 5 6 return 0; }
#includeThese examples use the TArray class provided by the Unreal Engine 4 library.#include int main() { TArray myArray = { "apple", "orange", "banana" }; const char* searchStr = "orange"; if (myArray.Contains(searchStr)) { std::cout << searchStr << " exists in the array."; } else { std::cout << searchStr << " does not exist in the array."; } // Output: orange exists in the array. return 0; }