[Solved] Is this an acceptable way to deallocate memory in c?
What you’re doing will work. Each time you increment contents, you also increment counter, so contents – counter gives you the original pointer that you can free. Of course, a better way of doing this would be to use a temporary pointer to increment through the allocated memory so you can use the original to … Read more