I'm very new to C and in this project, there's the following...
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"..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);
but I'm not sure how there can be such a value since we set what the pointer is pointing to to 0



LinkBack URL
About LinkBacks



