Results 1 to 3 of 3

Thread: SetArrayLength Question

  1. #1
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default SetArrayLength Question

    If I Have

    x: array[0..1] of integer;
    x[0]:=10;

    and then I do

    SetArrayLength(x, 3);

    will x[0] still be 10? or is it reset to 0?

  2. #2
    Join Date
    Jun 2007
    Posts
    246
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You cant set an array length when you already set it when you declared the variable so that wouldnt work, youd get a runtime error. but if you didnt declare it it would still be the same
    Example:
    SCAR Code:
    program New;
    var
    X: Array Of Integer;
    begin
    SetArrayLength(X,GetArrayLength(X) + 1);
    X[0] := 10;
    SetArrayLength(X,3);
    WriteLn(IntToStr(X[0]));
    end.

  3. #3
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah thats what I ment

    thanks, just needed to double check

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question please
    By hello9876123 in forum SRL Site Discussion
    Replies: 2
    Last Post: 05-05-2007, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •