I put the code inside code tags. The # button above the $) makes code tags.
You can quote-reply this post to see the code tags.
Does the keypad.getKey() function wait for a key to be pressed?
If not then that for loop will run in no time flat.
But you won’t notice at all. What you type will be echoed regardless.
You need to model more what you want to happen and how before coding.
Edited my post to reflect the different variables names. Your array and single key input variable can't have the same name. Start using code tags, or I'm going to stop posting.
Yeah that’s not going to work, the for loop will run, and then the loop() function will ‘loop’ itself again, and the for loop will start again (meaning it won’t stop after 10).
You name the int array 'key'. It is not good to name a char 'key' as well.
What is i? Where did you declare it?
It's a good thing that p doesn't increment because there's nothing to stop it from running past the end of key.
But don't fix those until you learn more how. You are not familiar with the code you try to write.
In your IDE click File->Examples->05 Control-> and go through all of those examples starting with Arrays. Then go do 02 Digital->BlinkWithoutDelay which tells how to deal with time on Arduino.