realloc
Dynamic multidimensional array reallocation
I\'m having some trouble with the realloc function. I\'m allocating a dynamic bidimensional array with this function:[详细]
2023-02-01 14:19 分类:问答reallocating boost::shared_array
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[详细]
2023-01-29 07:28 分类:问答Dynamic memory: malloc and realloc
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[详细]
2023-01-24 18:43 分类:问答How do I allocate more space for my array of C structs?
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:[详细]
2023-01-23 01:44 分类:问答Does realloc overwrite old contents?
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.[详细]
2023-01-18 18:53 分类:问答Replacing realloc (C --> C++)
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++)[详细]
2023-01-18 17:56 分类:问答Can realloc shrink my array on the left side (C only)?
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[详细]
2023-01-18 15:40 分类:问答What would realloc do if there is no sequential space of memory?
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.[详细]
2023-01-15 20:46 分类:问答How can I make sure that a caller passes a malloc'd pointer?
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[详细]
2023-01-08 19:38 分类:问答What is the correct usage of realloc() when it fails and returns NULL?
Can anyone summarize what is the correct usa开发者_Go百科ge of realloc()? What do you do when realloc() fails?[详细]
2023-01-08 15:06 分类:问答