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); */
}

Perhaps you could explain what you expect your code to do and what it's doing that fails to meet your expectation.

why doesn't argv[0] point to "MAMMAJAMMA" in main function after assigning *argv = line within the test_function? After test_function call its just null when I want it to point to string in main without having to store extra memory.

This question has already been answered. Start a new discussion instead.