void RemoveAll();
#includeint main() { CArray myArray; myArray.Add(1); myArray.Add(2); myArray.Add(3); myArray.RemoveAll(); return 0; }
#includeIn this example, a CArray of strings is created and two elements are added to the array. The RemoveAll function is then used to remove all elements from the array. Finally, the GetSize function is used to check the size of the array, which should be 0. The CArray class and the RemoveAll function are part of the MFC (Microsoft Foundation Class) library.#include using namespace std; int main() { CArray myArray; myArray.Add("Hello"); myArray.Add("World"); myArray.RemoveAll(); int size = myArray.GetSize(); // Should return 0 cout << "Size of array: " << size << endl; return 0; }