Barry.Cornelius@DURHAM.AC.UK (06/12/90)
In a previous message, Pete is having problems with his loops for processing
strings. I suggest:
PROCEDURE P(VAR S : ARRAY OF CHAR);
VAR k,n : CARDINAL;
BEGIN
n := Length(S);
FOR k := 1 TO n DO
process(S[k-1]);
END;
If you don't like the "k-1" then the other alternative is:
PROCEDURE P(VAR S : ARRAY OF CHAR);
VAR k,n : CARDINAL;
BEGIN
IF n>0 THEN
FOR k := 0 TO n-1 DO
process(S[k]);
END
END;
==
Barry Cornelius
==
Computer Science Group, School of Engineering and Applied Science,
University of Durham, Durham, DH1 3LE, England
JANET: Barry.Cornelius@uk.ac.durham
Internet: Barry.Cornelius%durham.ac.uk@cunyvm.cuny.edu
UUCP: ...ukc!cs.nott.ac.uk!bjc
BITNET/EARN: Barry.Cornelius%DURHAM@AC.UK
Tel: Durham (091 or +44 91) 374 2638, Secretary: 374 2630, Fax: 374 3741