08.04.2014 Views

Algorithmique et Langage - Pages de Michel Deloizy - Free

Algorithmique et Langage - Pages de Michel Deloizy - Free

Algorithmique et Langage - Pages de Michel Deloizy - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Constantes particulières<br />

Séquence<br />

Signification<br />

\r R<strong>et</strong>our chariot (en début <strong>de</strong> ligne).<br />

\n Saut à la ligne suivante. 0x0A<br />

\t Tabulation. 0x09<br />

\\ Caractère \<br />

\’ Caractère '<br />

\" Caractère "<br />

\xnn<br />

\ooo<br />

Exemple<br />

printf("<br />

("\rbonjour")<br />

printf("bonjour<br />

("bonjour\n") n")<br />

printf("Rés.<br />

("Rés.\tMoy.\n")<br />

Nombre hexadécimal<br />

Nombre octal (o : digit octal) \012,<br />

Résultat<br />

") bonjour<br />

bonjour!<br />

Rés.<br />

Moy. !<br />

printf("valeur : \\10\\\n")<br />

valeur : \10\!<br />

x='\''<br />

''-0x20<br />

x=39-32<br />

32 ⇒ x=7<br />

printf("Il dit : \"Bof!\"\n")<br />

Il dit : "Bof!" <br />

0x3B, 0xFA8 59, 4008<br />

012, \033<br />

10, 27<br />

Suffixe :<br />

Entier<br />

Virgule flottante<br />

Suffixes<br />

sans<br />

U ou u<br />

L ou l<br />

int<br />

unsigned int<br />

long<br />

double - long double<br />

! Exemples :<br />

12L :<br />

valeur 12 codée sur un type long<br />

40000u : codé sur un type unsigned int<br />

13.4 : constante double<br />

12.5f : constante float<br />

12UL :<br />

constante unsigned long int<br />

Applications :<br />

unsigned x = 120000UL*4/10000;<br />

long y = 15000L*4;<br />

F ou f<br />

float<br />

Float<br />

M. <strong>Deloizy</strong> <strong>Langage</strong> C<br />

17<br />

M. <strong>Deloizy</strong> <strong>Langage</strong> C<br />

18<br />

Organisation générale d’un module<br />

Déclarations<br />

…<br />

Fonction1<br />

…<br />

Fonction2<br />

…<br />

Définition d’une fonction<br />

! Déclaration :<br />

! du nom <strong>de</strong> la fonction,<br />

! du type <strong>de</strong> valeur r<strong>et</strong>ournée par la fonction<br />

! <strong>de</strong>s noms <strong>et</strong> <strong>de</strong>s types <strong>de</strong>s arguments transmis.<br />

! Corps <strong>de</strong> la fonction (entre accola<strong>de</strong>s) :<br />

! déclarations <strong>de</strong> données locales à la fonction<br />

! blocs d'instructions<br />

! r<strong>et</strong>our à la fonction appelante (avec un éventuel<br />

renvoi d'une valeur)<br />

M. <strong>Deloizy</strong> <strong>Langage</strong> C<br />

19<br />

M. <strong>Deloizy</strong> <strong>Langage</strong> C<br />

20<br />

5

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

Saved successfully!

Ooh no, something went wrong!