program t44; (* String subscripts, s[i], in both directions. A STRING is a length byte at s[0] followed by the characters, so s[i] selects the single byte at off+i: reading it yields a CHAR, and assigning to it stores one byte. Both a global and a local string are exercised, because the address paths differ (absolute vs [BP+off]). Only a CONSTANT index is covered: a variable index is ENoLib here, exactly as it already is for an array. *) var g : string[10] ; c : char ; procedure p ; var l : string[6] ; begin l := 'abc' ; writeln (l[1], l[2], l[3]) ; g[2] := l[3] end ; begin g := 'hello' ; writeln (g[1], g[2], g[3]) ; c := g[5] ; writeln (c) ; g[1] := 'H' ; writeln (g) ; p ; writeln (g) end.