Thanks to the great responses I got for my first two questions, I will post my third and hopefully last about this subject. This question has to do with using pointers as an array of arrays or strings. I basically want to know how to properly allocate and delete memory for something like:
Will this work? If not, how do I do it, using char** type variables has always confused me.Code:char** pArrayList = new char*[2]; pArrayList[0] = new char[8]; pArrayList[1] = new char[8]; strcpy(pArrayList[0], "letters"); strcpy(pArrayList[1], "letters"); delete [] pArrayList[0]; delete [] pArrayList[1]; delete [] pArrayList;