Yes. Open your book, or wherever you get you learning fix and get ready.
You want to use arrayvariables. You made up some syntax, the correct syntax is just as straightforward.
You will learn that in C , arrays have N elements that you get to say what N is, and the array elements are at indexes that will range from 0 to (N - 1).
It looks like you are also winging it on how to declare, define and the use variables of any type, so I will suggest you slow your role a bit and learn about basic variable types and how to use them in C++.
Are you using any book or youtube series or websites in particular?
Anything can turn up dozens of hits. If you add Arduino, you can get some focused results.
With these and practice you can code automation that doesn't require interrupts, about 98 or 99% without misusing interrupts.
I run button handling as a task function that watches button pins over time and stores those as bits read twice a ms. Every new read pushes the pin state bits up and the last is lost but I only care about the latest 8 reads as pin state history. In binary with button down == zero and up == one, when history is 10000000, that is button up to button down for 7 reads taken as transition and stable state for 3.5 ms in a single value. I use 2 byte vars per button to do that. One function to update pin histories and the code to Process only reads history byte to know the button from the noise.
Your version should be what you can understand that works and you evolve that as you grow in coding. Yes, I care that you improve. The links above should give you solid grounding to build on and Nick is a master at common-sense explanations.
So learn about C, and add as much C++ as you are up for or need.
As I said, to focus any searching for C++ that will be talked about mre in the exact circumstances of "embedded system programming", Arduino, for example, add "arduino".
variable defined (i.e. int varName) within a block (i.e. the braces) are local to that block and don't exist outside of it. you presumably want the variable defined globally, at the top of the program outside of any function definitions
variables are indexed with brackets (e.g. varName [i])
the value , your "{i}" should just be "i" (no brace nor brackets