Comparing arrays and structures for combo system

You should implement function which will save for example five last inputs in the array, and dynamically delete first element and add new key input. Also it will run check after each key press