Hello,
I have a query on dynamic allocation of memory in C. I am storing 4 seconds of audio data in a buffer allocated with sufficient memory using malloc function. If I wanted to record another 4 seconds of audio in the same buffer, I would have to increase the size of the buffer. Is using realloc function a better way and then using memcpy to store the audio in the buffer? My goal is to store 4 seconds of audio twice in the buffer.
Thank you.