cant figure out pointer assignment in c

Posted by vadiklk on Stack Overflow See other posts from Stack Overflow or by vadiklk
Published on 2010-12-30T21:47:47Z Indexed on 2010/12/30 21:54 UTC
Read the original article Hit count: 98

Filed under:
int add(char *var1, char *var2, char **var3) {
 int num1, num2, length1 = strlen(var1), length2 = strlen(var2), length = max(length1, length2) + 1;
 char *result = (char*) calloc(length, sizeof(char));
...
 free(*var3);
 *var3 = result;
 return 0;
}

out side of the function i get its still nothing(var3);

more detail:

int addSubCommand(char **vars, int isAdd) {
...
 return add(vars[index1], var2, &(vars[index3]));
}

that's where i call add. the char** vars goes from every function to the other.

© Stack Overflow or respective owner

Related posts about c