Apatosaurus could have held its head at most 17 feet (5.4 m) off the ground. Allosaurus, which was the biggest meat-eater at that time in North America, was only 15 feet (4.6 m) tall. So the Apatosaurus was safe from the Allosaurus because it couldn't attack its head or neck, and probably waited to attack the gigantic Apatosaurus when it got injured.
The Apatosaurus' nostrils were located on the top of its head. No one is sure why it had it there. It used to be thought that this was a snorkel-like device for a water living animal, but this theory couldnt be true. Since Apatosaurus fossils have been found far from any water-dwelling fossils, it is now believed that Apatosaurus spent most of its time on land, far from large bodies of water or swamps.