Home | Notes | Languages | Programs | Homework |
Re: Pascal Pointer Q |
Matthew Miller (namille2@VT.EDU)
Sat, 17 Feb 2001 13:11:04 -0500
Message-ID: <20010217131104.A12443@vt.edu> Date: Sat, 17 Feb 2001 13:11:04 -0500 From: Matthew Miller <namille2@VT.EDU> Subject: Re: Pascal Pointer Q
On Sat, Feb 17, 2001 at 11:44:31AM -0500, Scott Walker wrote:
> Is it possible to write a function that returns
> a pointer in pascal? The compiler doesn't seem
> to like function declarations like
>
> function intptr : ^integer
> begin
> ...
> end
Here is a way to get around that:
type intpointer = ^integer;
function intptr : intpointer;
var i : integer;
begin
writeln('test');
intptr := @i;
end; { intptr }
If you make a new type and use it as the return value it works.
Another question I have is what is the exit condition for the program? Does
the program exit cleanly if given empty input or maybe the word "quit"? The
spec doesn't seem to say.
Thanks, Matthew
-- Power corrupts. And atomic power corrupts atomically.
Home | Notes | Languages | Programs | Homework |