12.07.2015 Views

Langage Ca - Pages de Michel Deloizy - Free

Langage Ca - Pages de Michel Deloizy - Free

Langage Ca - Pages de Michel Deloizy - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• ð structures contenant <strong>de</strong>s tableaux.13 Autres types• les types définis par le programmeur• type<strong>de</strong>f• void• type<strong>de</strong>f unsigned char byte;• type<strong>de</strong>f unsigned short word;• type<strong>de</strong>f unsigned long dword;14 Déclaration <strong>de</strong>s variables• char x ; ⇒ x est un caractère(sur 8 bits : [-128…+127])[• int i, j, k ;⇒ i, j et k sont <strong>de</strong>s entiers(sur 16 bits : [-32768…+32767])[• unsigned arthur ; ⇒ arthur est un entier non signé(sur 16 bits : [0…+65535])• unsigned char octet ; ⇒ octet est un caractère non signé(sur 8 bits : [0…+255])• char tab[10] ; ⇒ tab est un tableau pouvant contenir10 caractères• double f[5][3] ; ⇒ f est un tableau <strong>de</strong> 5 ligneset 3 colonnes (15 x double)15 Tableaux• Le premier élément d’un tableau est d’indice 0.• Rangement consécutif en mémoire (Ex. <strong>de</strong> tab[0] à tab[9])• Tableaux multi-dimensionnés: le <strong>de</strong>rnier indice « court » le plus vite :f[0][0], f[0][1], f[0][2], f[1][0], f[1][1], f[1][2], f[2][0], … , f[4][1], f[4][2]16 ConstantesTypesÉcrituresExemples<strong>Ca</strong>ractère‘x’ ‘A’, ‘=’, ‘\\’,‘‘\’’‘Entiernnn ou ±nnn421, 0, -12, +456Entier exprimé en octal 0nnn ou ± 0nnn 0712, 010, -057Entier hexadécimal0xnn ou 0xNN0x4A, 0x00ffdouble± nnn.nn ou ± nnnE ± nn 1.0, -4., 3E4, 1.6e-1919Chaîne <strong>de</strong> caractères"xxxxxx""Bonjour les amis"Remarque : \ est le caractère d‘échappement en C17 Constantes particulièresSéquenceSignificationExempleRésultat\r Retour chariot (en début <strong>de</strong> ligne).printfprintf(" ("\rbonjour")bonjour\n Saut à la ligne suivante. 0x0A printf("bonjour("bonjour\n") n") bonjourÉ\t Tabulation. 0x09printf("Rés.("Rés.\tMoy.\n")Rés.Moy. É\\ <strong>Ca</strong>ractère \ printf("valeur : \\10\\\n")valeur : \10\É\’ <strong>Ca</strong>ractère 'x='\''''-0x20x=39-3232 ⇒ x=7\" <strong>Ca</strong>ractère "printf("Il dit : \"Bof!\"\n")Il dit : "Bof!" ?\xnnNombre hexadécimal0x3B, 0xFA8 59, 4008\oooNombre octal (o : digit octal) \012,\03310, 2718 SuffixesSuffixe :sansU ou uL ou lF ou fEntierintunsigned intlongfloatVirgule flottantedouble- long double Float

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!