I am reading through some code and I came across the following statement and it seems to make absolutely no sense. The line is coded below. It takes the first object of an NSMutableArray and then sends the “count” message. What exactly is this doing?
for (int j = 0; j < [[inputData objectAtIndex:0] count]; j++)
//inputData is just an NSMutableArray
Could someone please explain this to me? I have never come across this before. I thought at first maybe it was like a 2-D array scenario where array[x].length is different from array.length, but inputData is just a single NSMutableArray of like 10 numbers.
If your array(in this case
inpuData) has a key-value matching mechanism, this loop will increment its index but since everytime the condition is the same(the count of[inputData objectAtIndex:0]will never change ) this will cause an infinite loop