How do I get the pass by reference-thing to work in this example?
Since I'm still new to C I sometimes get confused in this matter, and this is one of those occasions.
I'm obviously doing something wrong.
what I want is of course the result to be "Parameters : something, something".
Thanks!
Since I'm still new to C I sometimes get confused in this matter, and this is one of those occasions.
I'm obviously doing something wrong.
Code:
int main(void) { char *params = mem_alloc(sizeof(char)*64); getParams(params); printf("Parameters: %s",params); mem_free(params); } int getParams(char *p) { p = "something, something"; return 0; }
Thanks!
Comment