Write a program to initialize large number of strings? - PASCAL

Write a program to initialize large number of strings?



- Strings are used as a constant and it helps in creation of the procedure and for the initialization process.

- Find the strings and assign it to the variable string. Then create a special string type that will help in initialization process.

- A custom procedure is required to initialize the string and use it to show some output and it is as follows:

const strlen = 250; { our "big" string }
cstlen = 12; { our constant strings }
type string = packed array [1..strlen] of char;
cstring = packed array [1..cstlen] of char;
var s: string;
procedure inistr(var s: string; c: cstring);
begin
for i := 1 to strlen do s[i] := ' '; { clear result }
for i := 1 to cstlen do s[i] := c[i] { place string }
end;
...
inistr(s, 'hello, world');
Post your comment