Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
William Sha
ai01_tp1
Commits
54bb422e
Commit
54bb422e
authored
Nov 18, 2017
by
William Sha
Browse files
Added some code for destruct, but does not operate
parent
7f41a522
Changes
3
Hide whitespace changes
Inline
Side-by-side
main.c
View file @
54bb422e
...
...
@@ -81,7 +81,7 @@ int main()
break
;
case
TOKEN_RMX_LI_ALL
:
destruct
(
NULL
);
destruct
(
default_list
);
break
;
}
...
...
tp3.c
View file @
54bb422e
...
...
@@ -147,8 +147,29 @@ void display(List* list){
}
void
destruct
(
List
*
list
){
void
destruct
(
List
*
*
list
){
if
(
DEBUG
)
printf
(
"DESTRUCT
\n
"
);
if
(
!*
list
){
printf
(
"List is already destroyed...
\n
"
);
}
while
((
*
list
)
->
head
!=
NULL
){
printf
(
"while
\n
"
);
Element
*
e
=
(
*
list
)
->
head
;
printf
(
"pointeurs : list head : %p, e : %p
\n
"
,
(
*
list
)
->
head
,
e
);
if
((
*
list
)
->
head
!=
(
*
list
)
->
tail
){
printf
(
"if
\n
"
);
(
*
list
)
->
head
=
(
*
list
)
->
head
->
next
;
}
printf
(
"free
\n
"
);
printf
(
"pointeurs : list head : %p, e : %p
\n
"
,
(
*
list
)
->
head
,
e
);
free
(
e
->
data
);
free
(
e
);
}
free
(
*
list
);
}
void
display_menu
(){
...
...
tp3.h
View file @
54bb422e
...
...
@@ -28,6 +28,6 @@ int remove_element(List* list, int p);
int
compare
(
char
*
str1
,
char
*
str2
);
int
sort
(
List
*
list
);
void
display
(
List
*
list
);
void
destruct
(
List
*
list
);
void
destruct
(
List
*
*
list
);
void
display_menu
();
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment