I'm trying to access the elements of an array and change them such as I have an array with numbers and variables x, I have to go through the array and replace the variables x with values. I tried this but I get an error at the for statement which is Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 2]'
if( [stack containsObject:@"X"] )
{
int x;
for(x=0; [stack objectAtIndex:x] ;x++)
{
[stack replaceObjectAtIndex:x withObject:[variableValues objectForKey:@"X"]];
}
stackto check theifcondition withisEqualTOString: