lloyddean:
Drewski:
What's the easiest way to determine size of an array. I'd rather not have a pinCount and arrayCount but Sizeof doesn't seem to work on arrays. I know I could probably put together some for loops to do the counting for me but I was hoping there'd be some function that could do it for me.Again - right in my last post!!!
#define ENTRIES(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
Sorry for that part. I glazed over that because I don't really understand that. Would you mind just stepping through it? What I do understand is your defining the a function "Entries" and a parameter "array". I just don't understand what exactly is going on after, or I should clarify in that I'm not following. I see your using the sizeof function with that array parameter and dividing by the first element of the array. I guess I'm missing the logic here as to why your dividing by the first element in the array.
Example. Entries(pins[]) = (sizeof(pins[])/sizeof(pins[0])) = 4/9???
UKHeliBob:
Size of array as in number of bytes it occupies or number of elements ?
Size of array as in number of elements.