I am writing a particle simulator, each particle has the following structure:
myFriend.name
myFriend.number
myFriend.position
myFriend.hisFriend
During the simulation the number of myFriend structures varies, as well as the number of hisFriend structures for each myFriend structure that is present at that time.
Is it kosher to allocate these "on the fly"? How does one deallocate them? Is deallocation necessary to prevent memory leaks? Sorry for the elementary nature of these questions. TIA!