Guest User

Untitled

a guest
Feb 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.47 KB | None | 0 0
  1. with Ada.Text_IO;
  2. with Ada.Unchecked_Deallocation;
  3.  
  4.  
  5.  
  6. procedure Aufgabe12b is
  7.  
  8.    type IntArr is array (Integer range <>) of Integer;
  9.    type Ptr is access IntArr;
  10.    procedure Free is new Ada.Unchecked_Deallocation (IntArr, Ptr);
  11.  
  12.    P : Ptr := new IntArr (1 .. 2000000);
  13.    Q : Ptr;
  14.  
  15. begin
  16.  
  17.    P.all := (others => 4);
  18.    Q := P;
  19.    Ada.Text_IO.Put_Line (Integer'Image (Q (1)));
  20.    Free (P);
  21.    Ada.Text_IO.Put_Line (Integer'Image (Q (1)));
  22.  
  23. end Aufgabe12b;
Add Comment
Please, Sign In to add comment