//shorthands to turn on the built-in pullup resistors for each pin

inline void digitalPullup(byte pin, boolean b) { pinMode(pin, INPUT); digitalWrite(pin, b?HIGH:LOW); }
#if defined(__AVR_ATmega1280__)
inline void analogPullup(byte pin, boolean b) { digitalPullup(pin+54,b); }
inline void analogPullup(byte pin, boolean b) { digitalPullup(pin+14,b); }

These functions avoid having to find or remember the "convention" (some have called it lunacy) that
the digitalWrite function can be done on the analog pin if you start numbering from the one beyond the last digital pin number.

Somebody should put these in the Arduino core so they can be tweaked every time a new Arduino chip is added.

Here is how you use these functions:

analogPullup(0, true); // enable the 20kOhm pull-up on analog pin 0

digitalPullup(3,true); // enable the 20k Ohm pull-up on digital pin 3