char ** makeargs(char *s, int * argc) //argc is num of strings to make in the array, s is the full string, need to break up. { strip(s); char sCopy[MAX], temp[MAX]; // = (char*) calloc(strlen(s) + 1, sizeof(char)); int count = 0, x = 0; strncpy(sCopy,s,strlen(s) + 1); printf("s = %s, sCopy = %s\n", s, sCopy); strncpy(temp,strtok(sCopy, " "), MAX); count++; printf("TEMP IS: %s at count %d | ", temp, count); while(sCopy != NULL) { strncpy(temp,strtok(NULL, " "), MAX); count++; printf("TEMP IS: %s at count %d, sCopy is: %s", temp, count, sCopy); } // seg fault when this loop ends due to outrunning sCopy's size. printf("\ns = %s, sCopy = %s\n", s, sCopy); *argc = count; }