I have a class myclass . In the main function, I create objects of myclass in every iteration and want to delete them after each iteration. I have not created the objects dynamically. Can I delete the them explicitly because I dont need them after the iteration gets over.
class myclass{
int value;
};
int main()
{
for(int i=0;i<count;i++)
{
myclass obj;
obj.do_function();
}
}
The object obj is no more needed after one iteration,but the memory is still there. How can I free that memory?
