Home  |   Notes  |   Languages  |   Programs  |   Homework

Problem with functions in pascal...

New Message Reply About this list Date view Thread view Subject view Author view

daward6@VT.EDU
Wed, 14 Feb 2001 18:04:52 -0500


Message-ID:  <3.0.6.32.20010214180452.0092f430@damianward.net>
Date:         Wed, 14 Feb 2001 18:04:52 -0500
From: daward6@VT.EDU
Subject:      Problem with functions in pascal...

I am having trouble passing arrays to and from functions.
I want to be able to do this:

(*************************************************)
//this function copies the first 20 valuse of t_list to s_list

FUNCTION intarray ( t_list, s_list : ARRAY OF INTEGER ) : ARRAY OF INTEGER;
VAR
        i : integer;
BEGIN
        FOR i:=0 TO 20 DO
                s_list[i] := t_list[i];
        intarray := s_list;
END;
(*************************************************)

But the compiler give me the error
 "Fatal syntax error: identifier expected, but ARRAY found."
It references the problem as coming from this location:
                                          V
"t_list, s_list : ARRAY OF INTEGER"
                             ^

This makes little sense to me, as this works in
other parts of my program:

(*****************************************************************)
FUNCTION idtoken (pos : integer; sentence : ARRAY OF CHAR) : integer;
(*****************************************************************)

Any suggestions? What am I doing wrong?
Thanks,
Damian


New Message Reply About this list Date view Thread view Subject view Author view

Home  |   Notes  |   Languages  |   Programs  |   Homework
copyright © 2001 Virginia Tech, ALL RIGHTS RESERVED
Class site maintained by Stephen H. Edwards <edwards@cs.vt.edu>