Suppose in a microcontroller ,you have configured the GPIO functionality of a particular pin to input, and if you read the state of the pin when nothing is connected to it,will it be high(Vcc) or low(Gnd).This is difficult to tell and the state it is present is known as floating state(high impedance state).To prevent this unknown state or floating state,a pull-up or pull-down resistor will ensure that the pin is either in a high state or low state. A pull-up resistor is connected to 3.3V or 5V (Vcc) and the pull-down resisitor is connected to ground(GND). Pull-ups are often used with buttons and switches. When the pull-up resistor is connected,the input pin will read a high state when the button is not pressed,a small amount of current will be flowing between the input pin and the VCC thus the input pin is reading to close to VCC.When the button is pressed it connects the input pin directly to the ground,the current flows through the resistor to the ground