Algorithmique et Langage - Pages de Michel Deloizy - Free
Algorithmique et Langage - Pages de Michel Deloizy - Free
Algorithmique et Langage - Pages de Michel Deloizy - Free
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Écritures possibles<br />
Opérateur ternaire<br />
! x = (a=3)+1;<br />
m<strong>et</strong> 3 dans a <strong>et</strong> 4 dans x<br />
! x -= = (a+=10); augmente a <strong>de</strong> 10 <strong>et</strong> soustrait le résultat <strong>de</strong> x<br />
! x = y = 2;<br />
m<strong>et</strong> 2 dans y puis y dans x<br />
! x = a+=2;<br />
ajoute 2 à a, puis m<strong>et</strong> le résultat dans x<br />
Opérateur<br />
?:<br />
Description<br />
choix d'une valeur selon une<br />
condition<br />
si la condition est vraie, la<br />
première expression est<br />
r<strong>et</strong>ournée, sinon, la<br />
<strong>de</strong>uxième expression est<br />
r<strong>et</strong>ournée.<br />
Exemple (a=5, b=3, c=1)<br />
x=(a>4)?(b*2):(c+1) ⇒ x = 6<br />
x=(a3)<br />
x = a++<br />
x = ++a<br />
⇒ x = -5<br />
⇒ x = 5<br />
⇒ x = -6(0xFA)<br />
⇒ x = 0<br />
⇒ x = 5, a = 6<br />
⇒ x = 6, a = 6<br />
--<br />
auto décrémentation (post ou pré)<br />
x = a—<br />
x = --a<br />
⇒ x = 5, a = 4<br />
⇒ x = 4, a = 4<br />
M. <strong>Deloizy</strong> <strong>Langage</strong> C<br />
35<br />
M. <strong>Deloizy</strong> <strong>Langage</strong> C<br />
36<br />
9