Outils pour utilisateurs

Outils du site


lang:c:variable

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
lang:c:variable [2020/03/04 23:19] – Création avec "Les types fondamentaux" rootlang:c:variable [2023/02/22 10:54] (Version actuelle) – Ajout de Pointeurs root
Ligne 1: Ligne 1:
 ====Les types fondamentaux==== ====Les types fondamentaux====
 +[[https://fr.cppreference.com/w/cpp/language/types|Types fondamentaux]] {{ :lang:c:variable:types_fondamentaux_-_cppreference.com_2020-03-04_23_22_53_.html |Archive du 22/11/2016 le 04/03/2020}}
 ===Booléan=== ===Booléan===
  
Ligne 35: Ligne 36:
  
 ''long double'' : 8 (32 bits) à 16 octets (64 bits). ''long double'' : 8 (32 bits) à 16 octets (64 bits).
 +
 +====Pointeurs====
 +
 +  * Influence de la position des ''const''
 +
 +<code c>
 +int main() {
 +  int a;
 +  int* b = &a;
 +  b = &a;
 +  *b = 1;
 +  const int* c = &a;
 +  c = &a;
 +  *c = 1;  // error: assignment of read-only location '* c'
 +  int const* d = &a;
 +  d = &a;
 +  *d = 1;  // error: assignment of read-only location '* d'
 +  int* const e = &a;
 +  e = &a;  // error: assignment of read-only variable 'e'
 +  *e = 1;
 +  int const* const f = &a;
 +  f = &a;  // error: assignment of read-only variable 'f'
 +  *f = 1;  // error: assignment of read-only location '*(const int*)f'
 +}
 +</code>
lang/c/variable.1583360373.txt.gz · Dernière modification : 2020/03/04 23:19 de root