*ptr = 0 what is the meaning
I'm very new to C and in this project, there's the following...
Code:
char *loc = NULL;
char *tempname = (char *) malloc(sizeof(char) * 255);
tempname = strdup(name);
char *oldname = strdup(name);
int i;
do
{
for (i = 0; i < OPLEN; i++)
{
//checking operator OP[i]
loc = strchr(oldname, OP[i]);
if (loc == NULL)
continue;
*loc = 0;
snprintf(tempname, 255, "%s%s%s", oldname, OP_REP[i], &loc[1]);
free(oldname);
oldname = strdup(tempname);
}
}
while (loc != NULL);
I'm unsure of the two bolded lines. it seems to me that the 2nd bolded line means "the address of the 2nd element in the dynamic array"..
but I'm not sure how there can be such a value since we set what the pointer is pointing to to 0