Many newer cars come with a compass installed. My Subaru has one on the rear view mirror. It shows "N", "NW", "W", etc. It seems to be reasonably accurate for rough cardinal directions.
Boat compasses are corrected for the local field of the boat by using small magnets mounted around the compass. The boat is pointed in a known direction such as magnetic north, and the small magnets are adjusted to a position so that the compass reads correctly. Then the boat is pointed in another known direction and the process is repeated. This is iterated until the compass is more or less correct.
You can never quite get the compass to read absolutely correctly using this method. Consequently for precise navigation boats will have a "Deviation Card", which gives a small correction to be applied for each desired coarse. To sail a given course, the navigator first determines the True course, then corrects for Variation (same as declination for us landlubbers), which gives the Magnetic course. Then one must correct for Deviation (using the deviation card) to get the Compass course to be steered.
To remember the series of corrections "
True" > "
Variation" > "
Magnetic" > "
Deviation" > "
Compass" there is the old salt's mnemonic
"True Virgins Make Dull Companions!"