The ancestors of dinosaurs were known as primitive archosaurs. Primitive archosaurs are reptiles and they are close relatives of lizards and snakes, which are known as lepidosaurs. Both archosaurs and lepidosaurs have 2 temporal openings in their skull and they are therefore known as diapsid reptiles. archosaurs have an additional opening in the skull, in front of the eyes, known as the antorbital fenestra and also a hole in the jaw bone. These holes are absent in lizards and snakes.
In contrast the reptiles that were the ancestors of mammals, including us humans, were synapsid reptiles. Synapsid reptiles have a single temporal opening in the skull. The number of openings in the skull has turned out to be a very reliable taxonomic character.
Crocodiles, alligators and the ancestor of birds also evolved from archosaurs. In contrast turtles and tortoises have no opening in the skull, and they are usually classified as anapsid reptiles. Scientists do not know everything there is to know. Scientists still do not know which reptile was the ancestor of turtles, and they are still debating which reptile was ancestral to birds. The ancestor of mammals is more clear, and it was a cynodont therapsid reptile. The ancestor of dinosaurs is also not known, although there are some archosaurian reptiles that are very similar to dinosaurs, and these archsaurs are Lagerpeton and Lagosuchus. They are close relatives of the ancestor of dinosaurs according to a majority of scientists.