arduino internal pull up resistor

C
pinMode(2,INPUT_PULLUP);void setup() {
  pinMode(13, OUTPUT);    // sets the digital pin 13 as output
}

void loop() {
  digitalWrite(13, HIGH); // sets the digital pin 13 on
  delay(1000);            // waits for a second
  digitalWrite(13, LOW);  // sets the digital pin 13 off
  delay(1000);            // waits for a second
}Serial.println(sensorValue, DEC);pinMode(13, OUTPUT);Serial.begin(9600);int sensorValue = digitalRead(2);
Source

Also in C: