Hi, I seem to be having a lot of problems with realloc, I have some int arrays, which I'm storing values in, I'm initially declaring there size using malloc, later on in the program I need to add more elements, one at a time to the array, so i do
When I then print out these arrays, it prints out elements as numbers likeCode:test = realloc(test,no_of_elements*4)
yet I'm only dealing with single digit numbersCode:4007400
If I comment out the realloc statements, and just add the elements anyway ignoring the fact I'm adding in elements out of bounds, then the output is printed out fine. Obviouslt I cannot leave it like this though as I'm out of bounds and that's unsafe.
I'm checking to see if realloc returns NULL whenever it is called, but it never does.
What is likely to cause this problem?
Thanks for any advice