How can variable length strings be used in Pascal?

Untitled Forums Programming Assignment Help How can variable length strings be used in Pascal?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15225
    Aakanksha
    Participant

    How can variable length strings be used in Pascal?

    • This topic was modified 8 years, 1 month ago by admin.
    #15229
    ahprofessional
    Participant

    Ans:- Pascal can use variable length strings as it doesn’t have built in type of string and it doesn’t prevent as well if the implementation is being done without it.
    The example shows the string that is being used and initialized. This is the variable length string that is being initialized.
    The concatenation can be done after completely defining the procedures and more options can be taken on the strings.
    type string = record
    len: integer;
    str: packed array [1..100] of char;
    end;
    The operations like Find Strings, Compare and all can be taken on the string or within it.
    The initialize process is used by combining various procedures with the strings as:
    var s: string;
    initstr(s, ‘mystring’);
    Using the initstr function the exact length of the string can be found by using the blank termination.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.