That error would indicate that next->ac
(p->ac
) is a value past the end of the memory allocated to next->acts
(p->acts
)
i.e...
next->acts = malloc( sizeof( something ) * count );
next->ac = count;
next>acts[next->ac].time = 0;
This would throw the error because count
as an array index is actually one past the size of the array (base zero and all that)
Put another way, next->ac >= count
would throw that error in the example I give.
Your program may work correctly because accessing past the end of allocated memory is undefined behavior. It could work, or it could spontaneously result in who knows what mayhem. But, all the same, accessing past the end of the allocated memory is an error.