Changing variable name

I'm currently working on a project for which I need to have this for loop:

for(int x = 0; x < 9; x++){

if(Pin1 == 1 && Pin2 == 0){
data = 1;
}
}

What i need to do is something like:

for example if x is 5:

if(Pin1 == 1 && Pin2 == 0){
data5 = 1;
}

So what i need is to change the name of the variable depending on x in the for-loop.

Is this even possible?
And if it is, how can i do this?

Is this even possible?

No. At run time, variables have addresses, not names.

Using an array is almost certainly the answer to whatever you are trying to do.

A large if chain and a pointer

ThatOne:
for example if x is 5:

if (Pin1 == 1 && Pin2 == 0){

data5 = 1;
}

If x = 5, why not something like:

  int data[10];

   if (Pin1 == 1 && Pin2 == 0){
       data[x] = 1;
   }

ThatOne:
What i need to do is something like:

for example if x is 5:

if(Pin1 == 1 && Pin2 == 0){
data5 = 1;
}

So what i need is to change the name of the variable depending on x in the for-loop.

Is this even possible?

You might want to use an array like

int data[10];

Then you can access each element of the array by either a constant index like

[data[5]

Or in a for-loop with loop index i you could address an element by coding

data[i]