segmentation fault(core dumped) while declaring vectors in c++ : I have been trying to use vectors but whenever i declare them globally , I get a segmentation fault(core dumped ) error. But when I specify a size on the vector I declared the error no longer occurs. If dynamic allocation occurs in vector then why is there a need of giving a size and what is this error? Someone please kindly explain 