It depends on how your program ends. If it ends with a main return (either with an explicit return, or with a drop in the end), then yes, any automatic objects will basically be destroyed.
But if your program terminates by calling exit (), then the main thing does not go out of scope, and no automatic objects will be destroyed.
source
share