Hi guys,
I would like to check with all of you. Let say if I would like to do something inside a function. Will it be better if I delcare a dynamic memory then using a static one?
Let say if I would like to store the value of the array into a temp array inside a function. How can I do it? will it be something like that? Do I need to add a null at the back of the char array ? what was the best way to do it ?
Code:void function(char* item1) { unsigned int i; char *p = (char*)malloc(strlen(item1) * (char)) for(i=0;i<strlen(item1);i++){ p[i] = item1[i]; } // some code free(p); }