I\'m having some trouble with the realloc function. I\'m allocating a dynamic bidimensional array with this function:
I have a shared_array: boost::shared_array myarr(new char[m_length]); I would like to reallocate the array. I thought of creating a new shared_array with the wanted size and using the swap boost meth
I am new to C and I am having trouble using dynamic memory. I malloc for struct figure and then realloc as needed. As I was trying to debug my code I noticed with the help of ddd that I overwrite one
I\'m trying to add 10 more elements to my struct that has been already malloc with a fixed sized of 20. This is the way I have my struct defined:
When we reallocate memory via realloc(), are the previous contents over-written? I am trying to make a program which reallocates memory each time we enter the data into it.
In an earlier question, I asked about typecasting pointers, but was directed to the better solution of using the C++ allocation system instead of mallocs. (I am converting some C code to C++)
I want to move a large chunk of data i\'ve got in my memory. Unfortunately this data is saved as an array, and i cannot change that. I can\'t use circular arrays, because the same memory is also used
realloc is used to reallocate the memory dynamically.开发者_如何转开发 Suppose I have allocated 7 bytes using the malloc function and now I want to extend it to 30 bytes.
I have a function which reallocs a pointer given as an argument to a new size. Now, the problem is that - according to the man page - realloc needs a pointer which has been returned by malloc or callo
Can anyone summarize what is the correct usa开发者_Go百科ge of realloc()? What do you do when realloc() fails?