{ This program illustrates the use of the character array routines scan, moveleft, moveright, and fillchar: } program three8; var ca,cb: packed array[0..9] of char; sa: string[30]; begin ca := '0123456789'; writeln(scan(10,='4',ca):3, scan(10,='4',ca[2]):4); writeln(scan(10,='X',ca):3, scan(5, ='X',ca):4); writeln(scan(-10,='8',ca[9]):3, scan(-10,='X',ca[9]):4); moveleft(ca,cb,sizeof(ca)); { copy ca to cb both ways } writeln(cb); moveright(ca,cb,sizeof(ca)); writeln(cb); moveleft(ca,ca[1],9); { the incorrct way to move characters up by one position } writeln(ca); moveright(cb,cb[1],9); { the correct way } writeln(cb); sa := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; writeln(sa); fillchar(sa[1],25,'0'); { a string is a packed array of char } writeln(sa); end. { 3-8 } { Executing this program results in the following output: 4 2 10 5 -1 -10 0123456789 0123456789 0000000000 0012345678 ABCDEFGHIJKLMNOPQRSTUVWXYZ 0000000000000000000000000Z }