18.08.2013 Views

Fondamenti di Informatica - Linguaggio C Le funzioni - Robotica

Fondamenti di Informatica - Linguaggio C Le funzioni - Robotica

Fondamenti di Informatica - Linguaggio C Le funzioni - Robotica

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Introduzione Dichiarazione e definizione I parametri Funzione main Car. avanzate<br />

Puntatori a funzione<br />

Esempio e uso <strong>di</strong> puntatori a funzione<br />

/* chiamo qsort <strong>di</strong>cendo che strcmp()<br />

\‘e la funzione <strong>di</strong> confronto da usare */<br />

qsort(strings, 100, sizeof(char *), strcmp);<br />

/* confronto solo i primi 5 caratteri */<br />

strncmp(strings[0], strings[1], 5);<br />

/* questo invece \‘e un errore,<br />

perché strncmp riceve tre argomenti */<br />

qsort(strings, 100, sizeof(char *), strncmp);<br />

Tullio Facchinetti <strong>Fondamenti</strong> <strong>di</strong> <strong>Informatica</strong> - <strong>Linguaggio</strong> C <strong>Le</strong> f

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

Saved successfully!

Ooh no, something went wrong!