Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours_prog
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
yassin.elhakoun
cours_prog
Commits
097ce03e
Commit
097ce03e
authored
4 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
correction typo
parent
74795d06
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/base_8.md
+5
-5
5 additions, 5 deletions
slides/base_8.md
with
5 additions
and
5 deletions
slides/base_8.md
+
5
−
5
View file @
097ce03e
...
...
@@ -5,7 +5,7 @@ date: 2020-01-06
# Tests unitaires
-
Compilation
`!=`
bon fonctionnement!
-
Compilation
`!=`
{.C}
bon fonctionnement!
-
Toujours tester vos programmes.
-
Tester les fonctionnalités une par une $
\R
ightarrow$
**tests unitaires**
.
-
Plus le code est modulaire, plus il est simple à tester.
...
...
@@ -102,7 +102,7 @@ int main(int argc, char **argv) {
*
En C on doit écrire chaque algorithme/structures de données pour des types précis (arbres, tri, ...).
*
Duplication du code pour chaque type possible et imaginable.
## Solution: `void *`
## Solution: `void *`
{.C}
*
En général, un pointeur connaît son
**adresse**
et le
**type**
des données sur lesquelles il pointe.
...
...
@@ -110,7 +110,7 @@ int main(int argc, char **argv) {
int *a = malloc(sizeof(*a));
int *b = malloc(sizeof(int));
```
*
Un
`void *`
le connaît
**que**
son adresse, au programmeur de pas faire n'importe quoi.
*
Un
`void *`
{.C}
le connaît
**que**
son adresse, au programmeur de pas faire n'importe quoi.
*
Vous avez déjà utilisé des fonctions utilisant des
`void *`
{.C}
```
C
...
...
@@ -158,7 +158,7 @@ void *foo(void *tab, int n_items, int s_items,
# Cas d'utilisation (2/3)
Avec un tableau d
'entier
##
Avec un tableau d
e `int`{.C}
```
C
bool cmp_int(void *a, void *b) {
...
...
@@ -174,7 +174,7 @@ int main() {
# Cas d'utilisation (3/3)
Avec un tableau d
'entier
##
Avec un tableau d
e `double`{.C}
```
C
bool cmp_dbl(void *a, void *b) {
...
...
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