Skip to content
Snippets Groups Projects
Verified Commit f68ec746 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

ajout feinte de const

parent 68bb9050
No related branches found
No related tags found
No related merge requests found
......@@ -52,4 +52,22 @@ const int *const p = &n; // la valeur p et *p sont const
p = &m; // erreur de compilation.
```
# Pointeurs et `const`
## Fonctions
```C
void foo(int *a);
void foo(const int *a); // on pourra pas changer *a
void foo(int *const a); // inutile on peut pas changer a
void foo(const int *const a); // identique à ci-dessus
```
## Mais.....
```C
const int a = 0;
int *b = (int *)&a;
*b = 7;
printf("a = %d\n", a); // affiche quoi?
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment