[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on modification of a list via a function invocation

Steve D'Aprano wrote:
> I think that these two increment procedures will be (more or less?) equivalent:
> procedure increment(var n: integer);
>   begin
>     n := n + 1
>   end;
> procedure increment2(p: intpointer);
>   begin
>     p^ := p^ + 1
>   end;

They are, with the proviso that, in standard Pascal, increment2
can only be applied to a heap-allocated instance of intpointer,
whereas increment can be applied to any variable of type