Most people will experience muscle cramps in their lifetime. They can occur during an activity or during rest (in the middle of the night, for instance).Common causes of a cramp, which is a painful and sudden involuntary contraction of the muscle, are dehydration, being low in calcium/magnesium or being low in potassium.
From my experience with clients, it is more often than not dehydration for the regular person. Athletes of high intensity activities may have cramps from overuse, overtraining and muscle fatigue - but should also indeed look at their intake of calcium/magnesium (the minerals need to be consumed together), and potassium.
To increase your intake of calcium and magnesium, aim to include more swiss chard, spinach, lowfat milk and plain yogurt, swiss, parmesan and edam cheeses, broccoli, almonds. Good sources of potassium include (but are not limited to) lima beans, potatoes, bananas, raisins, spinach, squash, brussel sprouts, bananas, beets and cantaloupe.
As for hydration, make sure that your urine is always a very light colour - if it's yellow, you're low! Drink up. Put it on the front burner of your priorities - it is so, so important.
And for immediate relief of the cramp (the most common muscles are the hamstrings and the calves) extend your leg fully and flex your foot back toward you. Stay calm, do this and hold it, and the muscle will release.
*featured photo found at www.munfitnessblog.com