Skip to main content

All Questions

1 vote
4 answers
2k views

Assign null to the address of a pointer

How can I deinitialize x inside the free_x function? I have to do it in order to fit to an API method. I can very easily deinitialize x just by assigning null to it but I have to do it inside the ...
sanchop22's user avatar
  • 2,819
0 votes
3 answers
1k views

How to free a double pointer that need to be returned from the function?

For example this is the codes for a function file, named fnx.c, where func() will be called from the main function. How should I free the TempArray here while return the double pointer to the main ...
randomGirl's user avatar
1 vote
1 answer
172 views

pointer to a pointer, which is pointing to a memory block, which pointer should be freed?

At the end of the code below, which pointer would I need to plug into free(), array or temp_array? Does it matter which one or would either free the memory block? int *array = 0; int *temp_array = 0; ...
Aelyn's user avatar
  • 37
0 votes
1 answer
185 views

Strange C error while freeing memory?

I'm still trying to get my genetic algorithm to work (yesterday I had a problem with memory allocation and consequently an awful error when attempting to free it) but today I have this piece of code ...
Jorge Cespedes's user avatar