Melman is one of the two tritagonists of Madagascar, Madagascar: Escape 2 Africa, and Madagascar 3: Europe's Most Wanted. He is a giraffe, who is somewhat of a hypochondriac, having doses of medicine for meals and doctor's appointments frequently.
Melman's personality deals with medical problems. Melman even complains about having spots on his neck. Despite this, he has a good heart.
Melman had a residence at the Central Park Zoo, where he would receive constant medical treatment for problems, that (oddly enough) were all a figment of his imagination.
Melman would undergo MRI machines, CAT scans, injections, flu shots, and be put into braces and crutches for no particular purpose at all.
In the Central Park Zoo, Melman received treatment, and was so used to his cushy life taking pills and undergoing treatments. One night, however, Marty escaped, and Melman immediately told Alex and Gloria.
In a flashback in Madagascar: Escape 2 Africa, there is a hint that Melman had a crush on Gloria as a child (as he seems uncomfortable when she comments that Alex is cute).
Plot for the Rest of his Role in the Second Film
When the animals nearly die, trying to fly back to New York in a salvaged airplane, Melman shouts that he is in love with Gloria. However, she is asleep and doesn't hear this. In Africa, Melman is horrified to learn that once a giraffe becomes sick, it has no way to survive and therefore, must simply wait in a hole to die. He takes the position of Witch Doctor (but introduces them to modern medicine) to cure sick animals, giving them longer and better lives.
While Melman proves to be very good at this job, he is informed by another giraffe that Melman has a brown spot on his shoulder. Thinking that he only has two days to live, Melman initially waits in a hole, but then takes King Julian's advice and goes to declare his love to Gloria. He finds her on a date and screams at her date what a wonderful girl Gloria is and to treat her right. When the watering hole dries up and King Julian decides to sacrifice an animal for the Water Gods, Melman offers himself. He is saved at the last moment, when Gloria tells him that she loves him back, it becomes apparent that the "brown spot" was not fatal, and that Alex is in need of rescue.