This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

malloc() use

Hi! Thank for the possibility to post here.!
I'm working with C51 C from Psoc 3 from Cypress.
I would need create functions that receive an array, does some process and return an array trough a pointer.
The caller function is in let say "Cal.c" file and the calling function is declared and defined in other file let say "Work.c ".
I've tried using return pointer declared like static in the function definition.
That work OK if both caller function and calling function are in the same .c file.

I've tried using mem_pool() and malloc(). For some reason not always those function work OK,
considering also that the caller function and calling function are not in the same file.
Let suppose I need to use 10 function of this type.
How many times I need to call mem_Pool and where?
How many times I need to call malloc() ?
Where I neede to define and declare malloc() and mem_pool?
At what point the code should I use free() for free memory allocation ()?
In which memory area ( data, xdata) is better allocate memory for those function?
I will appreciate very much some explanation.
Thank you very much.

Parents Reply Children