malloc/calloc in C subroutines

Hi all,

I want to implement a C subroutine, in which memory is allocated using malloc or calloc. The subroutine gets the address of a pointer (defined in the main function) as input and makes that pointer point to the allocated memory block. Now I am wondering whether that memory block will still be available after the subroutine is terminated and execution of the main function proceeds, or whether I might run into trouble.

Thanks for your help,

Rudey
Yes it will. Memory allocated through calloc/malloc is not free'd until you free it specifically.
Thanks a lot!
Topic archived. No new replies allowed.