Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lab0 doubly linked list
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mattias Erlingsson
lab0 doubly linked list
Commits
1cb6a94b
Commit
1cb6a94b
authored
5 years ago
by
Mattias Erlingsson
Browse files
Options
Downloads
Patches
Plain Diff
changed for-loop implementation
parent
387a9af7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
list.c
+0
-0
0 additions, 0 deletions
list.c
main.c
+8
-4
8 additions, 4 deletions
main.c
with
8 additions
and
4 deletions
list.c
100644 → 100755
+
0
−
0
View file @
1cb6a94b
File mode changed from 100644 to 100755
This diff is collapsed.
Click to expand it.
main.c
+
8
−
4
View file @
1cb6a94b
...
...
@@ -37,15 +37,18 @@ void delete (struct list *student_list) {
scanf
(
"%s"
,
&
array
);
struct
list_elem
*
e
;
for
(
e
=
list_begin
(
student_list
);
e
!=
list_end
(
student_list
);
e
=
list_next
(
e
)
){
for
(
e
=
list_begin
(
student_list
);
e
!=
list_end
(
student_list
);)
{
struct
student
*
s
=
list_entry
(
e
,
struct
student
,
elem
);
/*if the two arrays are equal we delete it and free memory*/
if
(
strcmp
(
array
,
s
->
name
)
==
0
){
struct
list_elem
*
temp
=
e
;
list_remove
(
e
);
if
(
strcmp
(
array
,
s
->
name
)
==
0
)
{
struct
list_elem
*
temp
=
e
;
e
=
list_next
(
e
);
list_remove
(
temp
);
free
(
s
->
name
);
free
(
s
);
break
;
}
e
=
list_next
(
e
);
}
}
...
...
@@ -70,6 +73,7 @@ void quit (struct list *student_list) {
free
(
s
->
name
);
free
(
s
);
}
exit
(
0
);
}
int
main
()
{
...
...
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