What's the precedence in the next expression?
item = (char*)heap + offset;
Is it (char*)(heap + offset)
or ((char*)heap) + offset
?
What's the precedence in the next expression?
item = (char*)heap + offset;
Is it (char*)(heap + offset)
or ((char*)heap) + offset
?
It's ((char *)heap) + offset
. Casts have much higher precedence than addition.