T
tfelb
Hey group!
I want to create a function to remove the last character in each array
element (its an array of char pointers) but I got an access violation.
I'm new to pointer to pointers, I have no idea.
Thanks for any help!
Tom
Here is my function:
void remArray(char *s[])
{
char **p = s;
int i = 0;
while(*p)
{
p[i++][strlen(*p)-1] = '\0'; // terminate the last character
in each array element
p++; //move to next array element
}
}
I want to create a function to remove the last character in each array
element (its an array of char pointers) but I got an access violation.
I'm new to pointer to pointers, I have no idea.
Thanks for any help!
Tom
Here is my function:
void remArray(char *s[])
{
char **p = s;
int i = 0;
while(*p)
{
p[i++][strlen(*p)-1] = '\0'; // terminate the last character
in each array element
p++; //move to next array element
}
}