Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Exam2_prog_C
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
william.ho
Exam2_prog_C
Commits
62114c86
Commit
62114c86
authored
2 years ago
by
william.ho
Browse files
Options
Downloads
Patches
Plain Diff
ex3 pas fini
parent
af3fcc70
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ex3/main
+0
-0
0 additions, 0 deletions
ex3/main
ex3/main.c
+71
-0
71 additions, 0 deletions
ex3/main.c
ex3/main.o
+0
-0
0 additions, 0 deletions
ex3/main.o
with
71 additions
and
0 deletions
ex3/main
0 → 100755
+
0
−
0
View file @
62114c86
File added
This diff is collapsed.
Click to expand it.
ex3/main.c
+
71
−
0
View file @
62114c86
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
typedef
struct
_element
{
// Elément de liste
int
data
;
struct
_element
*
next
;
}
element_t
;
typedef
struct
_ddl
{
element_t
*
head
;
element_t
*
pos
;
}
dll_t
;
void
free_liste
(
element_t
*
liste1
){
element_t
*
prec
=
liste1
;
element_t
*
current
=
liste1
;
while
(
current
->
next
!=
NULL
){
prec
=
current
;
current
=
current
->
next
;
free
(
prec
);
}
free
(
current
);
}
dll_t
*
dll_create
(){
dll_t
*
new
=
malloc
(
sizeof
(
dll_t
));
new
->
head
=
NULL
;
new
->
pos
=
NULL
;
return
new
;
}
void
dll_print
(
dll_t
*
liste
){
if
(
liste
!=
NULL
){
element_t
*
current
=
liste
->
head
;
while
(
current
!=
NULL
){
printf
(
"%d "
,
current
->
data
);
current
=
current
->
next
;
}
printf
(
"
\n
"
);
}
else
{
printf
(
"Empty"
);
}
}
void
dll_destroy
(
dll_t
*
liste
){
free_liste
(
liste
->
head
);
free
(
liste
->
pos
);
free
(
liste
);
}
void
dll_push
(
dll_t
*
liste
,
int
data
){
element_t
*
new
=
malloc
(
sizeof
(
element_t
));
new
->
data
=
data
;
new
->
next
=
liste
->
head
;
liste
->
head
=
new
;
}
int
main
(){
int
main
(){
int
size
,
tmp
;
dll_t
*
liste
=
dll_create
();
printf
(
"Liste d'entiers : "
);
scanf
(
"%d"
,
&
size
);
while
(
size
>
0
){
scanf
(
"%d"
,
&
tmp
);
dll_push
(
liste
,
tmp
);
size
--
;
}
dll_print
(
liste
);
dll_destroy
(
liste
);
return
(
0
);
return
(
0
);
}
}
This diff is collapsed.
Click to expand it.
ex3/main.o
0 → 100644
+
0
−
0
View file @
62114c86
File added
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment