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.

24void init_glob(){A=0;TOT=12E4;}Fonction ne renvoie rien → void25somme(inta, int b){int s;s=a+b;return s;}Type <strong>de</strong> la fonction est omis → int26double pi(voidvoid){double x;x=atanatan(1.0)*4;return x;}Fonction non déclarée → intIci : inclure math.h27 Prototype• Permet d'indiquer :• le type <strong>de</strong> donnée retourné par une fonction• le nombre et le type <strong>de</strong>s arguments transmis.è Déclaration <strong>de</strong> fonction.Exemples <strong>de</strong> prototype :double sin(double);double somme(double a, double b);28 Blocs d’instructions• Constitué :• d'une instruction élémentaire terminée par un caractère ";"ou• d'un ensemble d'instructions élémentaires encadrées par <strong>de</strong>s accola<strong>de</strong>s; dans ce cas, le blocd'instructions peut comporter <strong>de</strong>s déclarations (locales à ce bloc).ou• d'un simple caractère ';'.''. Dans ce cas, l'instruction est vi<strong>de</strong> (sans effet).29 Exemplesx = 2*a + b;ou :

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

Saved successfully!

Ooh no, something went wrong!