Geting multiple input from 4x4 keypad and show it oled display

I am using this code to store input number and show it in oled display.
I want to store 3 digit vale.
I cant write a error free working code.
It will be really helpful if i get some guidance .

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {

byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6,7,8,9}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){

void loop(){
char key = keypad.getKey();
// just print the pressed key
if (key){

// this checkes if 4 is pressed, then do something. Here we print the text but you can control something.
if (key ==‘4’){
Serial.println(“Key 4 is pressed”);

What error messages do You get?

The code you posted compiles error-free. Try posting the code you wrote, along with the errors you are getting and people can help you.

Also, please read the sticky post at the top of the forum about how to format your code using code tags so it makes it easier for people to help you.

Also, can you show your wiring?