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

Create successful ePaper yourself

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

Les comman<strong>de</strong>s if, if<strong>de</strong>f, ifn<strong>de</strong>f, endif<br />

Exemple<br />

→ Compilation conditionnelle<br />

#if expression<br />

#else<br />

Source compilé dans le<br />

cas contraire<br />

#endif<br />

Source compilé si<br />

l’expression est vraie<br />

#if<strong>de</strong>f symbole<br />

#else<br />

Source compilé si le<br />

symbole est défini<br />

Source compilé dans le<br />

cas contraire<br />

#endif<br />

#ifn<strong>de</strong>f symbole<br />

#else<br />

Source compilé si le<br />

symbole n’est pas<br />

défini<br />

Source compilé dans le<br />

cas contraire<br />

#endif<br />

#if<strong>de</strong>f<br />

__TURBOC__<br />

#inclu<strong>de</strong><br />

<br />

#if MODEL== __SMALL__<br />

int *px<br />

;<br />

#else<br />

void *px<br />

;<br />

#endif<br />

#endif<br />

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

121<br />

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

122<br />

Transtypage<br />

Initialisation <strong>de</strong> données<br />

! cast<br />

→ Conversion <strong>de</strong> type explicite<br />

→ Perm<strong>et</strong> d'indiquer au compilateur le type à utiliser<br />

Exemples :<br />

x = (long)a * b/c;<br />

void CopyDat(void<br />

*d, void *s, size_t sz)<br />

{<br />

size_t i;<br />

for(i=0; i

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

Saved successfully!

Ooh no, something went wrong!