In my main I call the function that calls the above function twice, sequentially. The first time, the function that calls the above function executes, everthing is fine and I get the desired output. The second time I call the function that calls this function, the malloc statement at the start of this function returns a NULL. I have tried time and time again to get around this. Does anyone have any ideas?
I have tried using preset array size (the output will always be a 64 byte string), but to no avail. This function comes at the end of the function that calls it, and I have stepped through it a thousand times. Malloc always returns NULL the second time I call the function. Thanks in advance.
Not sure if it makes a difference, but the structure I send the function has 64 individual bits and the purpose of the function itself is to look at the bits and create a character string of 1's and 0's.
actually it didn't work, you just had luck (or unluck)
it didn't crashed before. you had accessed a memory
that is not belongs to you therefore one of the next scenarios
1. your valus will be overriden
2. you override data that is in used not by you
each of these cannot be concidered as "worked"...