I have this function:
byte GD_FindButton(BUTTON **array, TPoint *Touchposition)
{
int i = 0;
for (i = 0; i < sizeof(**array); i++)
{
if ((Touchposition->x > (*array)->x1) && (Touchposition->x < (*array)->x2) && (Touchposition->y > (*array)->y1) && (Touchposition->y < (*array)->y2))
return (*array)->name;
array++;
}
return 0;
}
where **array
is a pointer of pointer declare as is:
BUTTON **button_array[2] = { &home, &start };
that contain
BUTTON home = { 20, 145, 70, 195, 'h' };
BUTTON start = { 84, 33, 236, 185, 's' };
I have to detect the size of the **button_array
for prevent overflow during the for loop but I have problem to understand how to do.
Can you help me?
Thanks!!