Sean 'Captain Napalm' Conner wrote:
Gee, I think I could do that in one memory
location---cache the value of
the first pointer. Keep following the list, checking each address against
the cached value. If you hit 0, it terminates, otherwise if the address
matches the cached value, you have a loop. The above method is cleverness
(not) for cleverness sake.
That only works if the first pointer is part of the loop.
.