Skip to content

Instantly share code, notes, and snippets.

@mapio
Last active October 12, 2015 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapio/4101049 to your computer and use it in GitHub Desktop.
Save mapio/4101049 to your computer and use it in GitHub Desktop.
La stupidità degli studenti…

Come si fa a stampare il p-esimo valore di un vettore v (diciamo di N interi)?

for ( i = 0; i < N; i++ ) 
    if ( i == p ) printf( "%d", v[ i ] );
    else printf( "non trovato" );

E si stupiva pure che stampasse N-1 volte "non trovato"!

La giustificazione: "credevo che l'unico modo per accedere ai valori del vettore fosse usare l'espressione v[ i ]"… detto altrimenti: pensava che tra le quadre ci si potesse mettere solo i!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment