stm32f103 ADC strange behaviour
I think you are mentioning the case of a so called floating input. When there is nothing connected to an input (either digitally or analog), the value you get is indetermined, and it is instable (meaning it can change for every reading you make). Always make sure you have something connected that you want to read to an input, AND in cases the input is not driven by an output (in case of an 'uninitialized' output connected to the input, or in case the MCU starts up), use a pull up/pull down resistor (some MCUs have one or both of them already built in and you can select it when you determine the pin properties).