Hello,
I am trying to figure out why pointer address is not preserved over a function call and how to fix it. For example:
void test_function(char **,char *);
int main() {
char **argv = calloc(64,sizeof(char *));
char *line = "MAMMAJAMMA!";
test_function(argv,line);
printf("argv[0] == %s",argv[0]);
return 0;
}
void test_function(char **argv,char *line) {
/* pointer value not kept with this why? */
*argv = line;
/* I know this works , but want way with pointers only if possible */
*argv = malloc(20);
strcpy(*argv,line); */
}