13 שיעור 


1) type str=string[3];               2) program Pointers;
        item=record                     type chPnt=^char;
          data:str;                     var FirstPtr,SecPtr,ThPtr:chPnt;
          next:integer                  begin
        end;                              new(FirstPtr);
        ListType=array[1..20] of item;    new(SecPtr);
    var List:ListType;                    FirstPtr^:='A';
        First, Last, Current:integer;     SecPtr^:='B';
                                          ThPtr^:=FirstPtr;
    type BigArray=array[1..1000] of       write(FirstPtr^);
           integer;                       write(SecPtr^);
    var score:integer;                    write(ThPtr^)
        myArray:BigArray;               end;
                                FirstPtr=73982    FirstPtr^='w'
       score:=7;                SecPtr=32091      SecPtr^='~'
       for i:=0 to 1000 do      ThPtr=894821      ThPtr^='|'
         myArray[i]:=0;

3) type CharPoint=^char;
        NodePoint=^NodeType;
        NodeType=record
          Letter:char;
          Next:NodePoint
        end;
    var FirstPtr, SecPtr:CharPoint;
        FirstNodePtr, SecNodePtr:NodePoint;

    new(FirstPtr);  new(FirstNodePtr);          new(FirstNodePtr);
    dispose(FirstPtr);                          FirstNodePtr^.Letter:='W';
    dispose(FirstNodePtr);
                                                LastNodePtr:=FirstNodePtr;
    new(NodePoint);   new(FirstNodePtr);
                                                new(LastNodePtr);
    new(FirstPtr);                              LastNodePtr^:=FirstNodePtr^;
    new(FirstPtr);

    new(FirstPtr);
    FirstPtr^:='T';
    SecPtr:=FirstPtr;

4) program Node;                     p=389201
   type ptr=^node;                   p^=  ( '+', 130497)
        node=record                  q=64792
               letter:char;          q^=  ( 'a', 93801)
               next:ptr
             end;                5) p^
   var p,q:ptr;                     p^[3]
   begin                            p^.num
     new(p);
     q:=p;                          p:=5;       p^:=5;
     p^.letter:='A';                p^:=nil;    p:=nil;
     new(p^.next);                  write(p);   write(p^);
     q:=q^.next;                    p^:=q+r;    p^:=q^+r^;
     q^.letter:='b';
     q^.next:=nil
   end.

6) type ptr=^row;                       p:=nil;      p^:='X';
        row=array[1..10] of char;       new(p);      p^[1]:='Z';
   var p:ptr;                           p^:=nil;     ptr[2]:='A'
   new(p);                              p:='X';