The ulnar nerve is one of the only nerves in the entire human body that has a part not protected by muscle or bone. Nerves are protected in this way so that we don't bang them, as this can hurt and cause adverse, although temporary, effects such as pins and needles and numbness. When you hit your 'funny bone' you are in fact not hitting a bone at all, but the exposed section of the ulnar nerve.
Because this nerve is exposed at one point and it's so easy to hit, it's also easy to accidentally trap this nerve between the bones and muscles that protect it further along the arm. This condition is known as ulnar nerve compression, or ulnar nerve entrapment, which can be painful but is generally very treatable.
When nerves become compressed between muscles and/or bones they are unable to send sensory information to the brain for processing, mainly because the information cannot pass through the nerve fibers. This can have a number of results, depending on how severely compressed the nerve is. If the compression is minor then the individual might feel a considerable amount of pain, and possibly some pins and needles. As compression worsens, so does the pins and needles, but numbness may start to take over the pain and only tingling might be felt. Pain is usually common with every instance of ulnar nerve compression, however.
Individuals suffering from ulnar nerve compression are often advised to take regular doses of ibuprofen or other anti inflammatories both to manage pain and to stop the tissues surrounding the compressed nerve from swelling even further. They may be given some stretching exercises to try and free the nerve naturally too. For most people these two treatments, plus a bit of patience and resting of the arm affected are usually all that's needed for the condition to right itself.
However, some individuals suffer chronic ulnar nerve compression, which means that it cannot free itself simply by stretches and stopping regular or rigorous use of the arm. These cases should be treated urgently, because if a nerve is trapped for too long (usually a matter of months, rather than weeks) then the nerve can undergo considerable damage, leading to permanent symptoms. In this case surgery on the ulnar nerve may be required.
Many people suffer from compressed nerves throughout their lifetime, although some are certainly more prone to this kind of condition than others. For example, if there is a history of compressed nerves in your family then it's not unlikely that you will suffer one too. Your family's bodies are genetically predisposed to grow in a way that makes ulnar nerve compression easier to suffer. There is nothing you can do or not do to avoid this condition. Women are more prone to developing it during pregnancy, due to considerable bodily changes, yet this is temporary and the ulnar nerve usually rights itself shortly after birth.
If you're suffering from pain in your elbow, forearm, wrist, hand or fingers as well as tingling, numbness or pins and needles then you should not delay visiting your doctor. Any course of treatment advised will include pain relief and will be the least invasive avenue possible.