Variable inside of a variable

Happy Thanksgiving All,
I am simply trying to place a variable inside of another variable as demonstrated below (incorrect coding);

int variable1 = 2;
int variable2 = 1;
int digit[x]a; //where "x" = variable1 or variable2 for "digit a"
int digit[x]b; //where "x" = variable1 or variable2 for "digit b"

void setup() {
//content here
}

void loop() {
//content here

shiftOut(dataPin, clockPin, digit[x]a);
shiftOut(dataPin, clockPin, digit[x]b);

//content here
}

Does anyone know of an existing example of this or how to do this? Thank you for any insight.

Read up on arrays: http://arduino.cc/en/Reference/Array

I think this is what you need:)

//int variable1 = 2;
//int variable2 = 1;
int digit[2] = { 2 , 1 }; // digit now contains two integers, 2 and 1 at indexes 0 and 1

void setup() {
//content here
}

void loop() {
//content here

shiftOut(dataPin, clockPin, digit[0]); //acces data stored in index 0 (2)
shiftOut(dataPin, clockPin, digit[1]); //acces data stored in index 1 (1)

//content here
}

Thank you AlphaBeta,
That linked helps but I'm still having issues:

int variable1 = 0x02;
int variable2 = 0x04;
int variable[4] = {0,1,2,3}
int number;

void setup() {
//content here
number = 1;
}

void loop() {
//content here

shiftOut(dataPin, clockPin, variable[number]); //only turning on pin1 versus 0x02

//content here
}

As stated in the code above, when I do this I am only getting pin1 when I need 0x02. Thank you for any insight.

int variable[2] = {0x02, 0x04}
int number;

void setup() {
//content here
number = 0;
}

void loop() {
//content here

shiftOut(dataPin, clockPin, variable[number]); //only turning on pin1 versus 0x02

//content here
}

Arrays index values always go from 0 to SIZE-1 (0 = first element, 1 = second element...)