i having problems with this kind of code:
im attempting to malloc vars in different functions, but the output of this is garbage. why?Code:int malloc_me(char *ptr) { ptr = malloc(10); strcpy(ptr, "it works"); return 0; } int main() { char *test; malloc_me(test); printf("%s\n", test); free(test); return 0; }



LinkBack URL
About LinkBacks



[/edit]