Hi, I've got a small problem. I've got an array and its size changes when passing to a c-function from an objective-c function.
void test(game_touch *tempTouches)
{
printf("sizeof(array): %d", sizeof(tempTouches) );
}
-(void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event
{
game_touch tempTouches[ [touches count] ];
int i = 0;
for (UITouch *touch in touches)
{
tempTouches[i].tapCount = [touch tapCount];
tempTouches[i].touchLocation[0] = (GLfloat)[touch locationInView: self].x;
tempTouches[i].touchLocation[1] = (GLfloat)[touch locationInView: self].y;
i++;
}
printf("sizeof(array): %d", sizeof(tempTouches) );
test(tempTouches);
}
The console log is:
[touchesEnded] sizeof(array): 12
[test] sizeof(array): 4
Why is the size different in 2 of the methods?
In the [test] method the returning size is always 4, not depending on the original size of an array.
Thanks.