The analogReferece() sets the reference voltage for analog input. It just sets a global variable.
The analogReference() is defined in hardware/arduino/avr/cores/arduino/wiring_analog.c as below.
The input is mode and its type is uint8_t. The mode can be one of ‘DEFAULT’, ‘INTERNAL’ or ‘EXTERNAL’.
This function stores the mode into the global variable named analog_reference. The analog_reference is used in analogRead().
June 19, 2020