Really the best way to understand anything about dinosaurs is by looking at living animals. You look at birds and then look at the closest living ancestor of birds, which is the crocodile. If you look at characteristics that birds and crocodiles have in common, the explanation is that the trait was in the common ancestor that birds and crocodiles had at one time.