Arduino keypad security code

Hello, iam required to make an arduino code that reads from the keypad input and check if it matches with some security code. The code shouldn't include an array to activate the keypad, i already wrote a code to make the keypad work and display on serial monitor, but I don't know how to continue the code in order to make it read the pressed button and compare it to a certain 4 digit cose

The code shouldn't include an array to activate the keypad,

Why? It that what it says in the class assignment, or did you mis-read or mis-interpret that part?

Please read the forum guide in the sticky post and then give all the detail in your next post that you did not include in your first post.

@paulRB it is required this way mate, class assigment we shouldnt enter the keypad code as an array

Then ask teacher why you must not use an array. I still think you may have mis-interpreted that, because it would be a crazy requirement to put in an assignment. Perhaps you are meant to challenge it.

Maybe what teacher meant is that the pass code must not be embedded in the sketch.
That is, the pass code is set by entering it through the keypad (preceded by as special key sequence) and stored in the EEPROM. That means the pass code can be changed without uploading a sketch.

Then you need to post here the complete text of the assignment.

You will also need to cite any answers you obtain here by way of reference in your assignment submission.