Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dynamic_vectors
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PREMIERE
PROG_SEQ
dynamic_vectors
Commits
d620a77f
Commit
d620a77f
authored
3 years ago
by
abivarma.kandiah
Browse files
Options
Downloads
Patches
Plain Diff
Add Vector Free
parent
99e13923
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
header/vectors.h
+1
-0
1 addition, 0 deletions
header/vectors.h
src/test_vectors.c
+4
-0
4 additions, 0 deletions
src/test_vectors.c
src/vectors.c
+6
-0
6 additions, 0 deletions
src/vectors.c
with
11 additions
and
0 deletions
header/vectors.h
+
1
−
0
View file @
d620a77f
...
@@ -28,5 +28,6 @@ type vector_get(vector vec, int index);
...
@@ -28,5 +28,6 @@ type vector_get(vector vec, int index);
type
vector_remove
(
vector
vec
,
int
index
);
type
vector_remove
(
vector
vec
,
int
index
);
void
vector_insert
(
vector
vec
,
type
element
,
int
index
);
void
vector_insert
(
vector
vec
,
type
element
,
int
index
);
void
vector_empty
(
vector
vec
);
void
vector_empty
(
vector
vec
);
void
vector_free
(
vector
vec
);
#endif
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/test_vectors.c
+
4
−
0
View file @
d620a77f
...
@@ -49,6 +49,10 @@ int main()
...
@@ -49,6 +49,10 @@ int main()
vector_empty
(
test
);
vector_empty
(
test
);
printf
(
"Empty Vector lenght : %d
\n
"
,
vector_length
(
test
));
printf
(
"Empty Vector lenght : %d
\n
"
,
vector_length
(
test
));
//Test Vector Free
vector_free
(
test
);
return
0
;
return
0
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/vectors.c
+
6
−
0
View file @
d620a77f
...
@@ -122,3 +122,9 @@ void vector_empty(vector vec)
...
@@ -122,3 +122,9 @@ void vector_empty(vector vec)
vec
->
content
=
realloc
(
vec
->
content
,
sizeof
(
type
)
*
vec
->
capacity
);
vec
->
content
=
realloc
(
vec
->
content
,
sizeof
(
type
)
*
vec
->
capacity
);
assert
(
vec
->
content
!=
NULL
);
assert
(
vec
->
content
!=
NULL
);
}
}
void
vector_free
(
vector
vec
)
{
free
(
vec
->
content
);
free
(
vec
);
}
\ No newline at end of file
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