sillv0r
September 4th, 2007, 12:59 AM
First quick question, is there a difference between these two declarations:
char* pOne[];
char** pOne;
Second question:
I'm storing a group of strings using an array of pointers:
char** temp = new char*[oldSize+1];
for(int i=0;i<oldSize;i++)
{
temp[i] = new char[30]; // lines of interest
temp[i] = ptrToAnArray[i];
}
The two lines marked as 'lines of interest,' are these going to do what I think?
As in will the array that is pointed to by 'ptrToAnArray[i]' be copied into the memory block that temp[i] is pointing to?
Or is the address pointed to by temp[i] going to now be pointing to the address that ptrToAnArray[i] was pointing to?
(I could probably just as easily type up a program to answer my second question, but I figured if someone knows off the top of their head there's no harm in asking.)
I tried to be complete in my question, but if something doesn't make sense let me know.
char* pOne[];
char** pOne;
Second question:
I'm storing a group of strings using an array of pointers:
char** temp = new char*[oldSize+1];
for(int i=0;i<oldSize;i++)
{
temp[i] = new char[30]; // lines of interest
temp[i] = ptrToAnArray[i];
}
The two lines marked as 'lines of interest,' are these going to do what I think?
As in will the array that is pointed to by 'ptrToAnArray[i]' be copied into the memory block that temp[i] is pointing to?
Or is the address pointed to by temp[i] going to now be pointing to the address that ptrToAnArray[i] was pointing to?
(I could probably just as easily type up a program to answer my second question, but I figured if someone knows off the top of their head there's no harm in asking.)
I tried to be complete in my question, but if something doesn't make sense let me know.