Code:
Activity **newTable = new Activity*[tableLength]; // 3 activities in newTable => is this correct?
I may just be a semanic quibble, but no it is not right. The only thing in newTable is the address in memory where an array is located. newTable is said "to point" to that array. The array contains 3 Activity pointers, which means that each of them can be made to point to an Activity object (or an array of Activity objects).
Code:
Activity *act = getActivity(i); // getActivity(i) returns Activity*
Is getActivity() a function? Or, is it a method of a class? If it's a method of a class it has to be called using an object of that class--unless it is a static method, which means you would call it with the class name.
Code:
memmove(newTable[i], act, sizeof(Activity*)); // is this correct?
Couldn't say...I've never heard of a memmove() function, which means if it exists, it's probably a C function.
Code:
// is this correct =>> newTable[i] = act;?
Yes, assuming act is of type Activity*. newTable is a pointer to an array of Activity pointers, and you can use array notation with a pointer to an array to access the elements of the array. That means:
newTable[0]
newTable[1]
newTable[2]
are all of type Activity* and can be assigned an Activity*.
Code:
delete []act; // is this correct?
It doesn't look like it, but you can't tell from the code whether the pointer assigned to 'act' points to memory that was dynamically allocated with new. The brackets are for deleting a pointer that points to an array. If instead, a pointer points to a single element, then you just use delete.
If you have a pointer to an array of pointers, and each of the pointers in the array points to dynamically allocated memory, first use a for loop to delete the memory pointed to by each of the pointers in the array using delete. Then, after the loop has finished, delete the pointer to the array using delete [].