I want to change a 2dim char array in a function.
I allocate the space like
char **u;
u = new char * [ MAX_DEPTH ];
for (i=0; i<MAX_DEPTH; i++)
u[ i ] = new char [ BUFFER_SIZE ];
the function looks like
rem(char ***arr, int max_length, char *url)
{
int idx=0;
char * p;
int i;
p = strtok (url,"/");
while (p != NULL && idx < max_length)
{
for ( i=0; i<maxUrlSize-1 && p[i] != '\0'; i++)
(*arr)[idx][i] = p[i];
for ( ; i< maxUrlSize-1; i++)
(*arr)[idx][i] = '\0';
}
}
the function will be used in my main program.
rem( &u, MAX_LEN, url);
but after leaving the function there is nothing in. Could someone explain me how to use pointers in this way?