Bonjour,
J'ai créer un tableau de pointeurs de type integer mais à la compilation il me met : array type required in indexed component.
Voici mon fichier list.ads :
list.adb :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 with ada.text_io; use ada.text_io; with ada.integer_text_io; use ada.integer_text_io; with ada.float_text_io; use ada.float_text_io; with ada.Strings.Unbounded; use ada.Strings.Unbounded; with ada.Text_IO.Unbounded_IO; use ada.Text_IO.Unbounded_IO; with ada.Containers.Generic_Array_Sort; with Ada.Unchecked_Deallocation; package list is type MAX_TAB is range 1..9; procedure List_Display; type pList is private; private -- Lettre r devant une variable veut dire record. -- Lettre p : pointeur. type pNode is access integer; type pList is array(MAX_TAB) of pNode; end list;
Le main.adb :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 package body list is procedure List_Display is begin put("Pour éviter que le compilo râle"); end List_Display; end list;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 with ada.text_io; use ada.text_io; with ada.integer_text_io; use ada.integer_text_io; with ada.float_text_io; use ada.float_text_io; with ada.Strings.Unbounded; use ada.Strings.Unbounded; with ada.Text_IO.Unbounded_IO; use ada.Text_IO.Unbounded_IO; with list; use list; with ada.Containers.Generic_Array_Sort; with Ada.Unchecked_Deallocation; procedure main is List : pList; begin List(1) := new integer'(120); put("List(1).integer = "); put(List(1).integer); new_line; end main;





Répondre avec citation





Partager