Pterodactyls

The primary purpose of the cranial crest has not yet been determined.

An excerpt from the article 20 facts about pterodactyls
It may have served as a counterbalance to their long beaks to avoid stressing neck muscles. Paleontologists also theorize it may have served as a mid-flight rudder or may have been used to court females.