What the first answer is trying to say is that the "stride" between two elements is the offset in bytes between the beginning of one element and the beginning of the next.
However, if the elements you're passing are contiguous (i.e. there's no space between them), you can pass 0 for the stride parameter.
I would say that it's wrong to claim that "stride is 0" in this case - the stride is sizeof(element)
, but the value 0 gets special treatment and is taken to mean sizeof(element)
.
This is most likely done so the poor programmer doesn't have to use two (bug-prone) sizeof
parameters in the common case when they are the same.