Il Deitel. Questo è l'esempio in questione (un po' abbreviato):
codice:
#include <stdio.h>
#define SIZE 5
void modifyArray( int b[], int size );
int main()
{
int a[ SIZE ] = { 0, 1, 2, 3, 4 };
int i;
printf( "Effects of passing entire array by reference:\n\nThe "
"values of the original array are:\n" );
for ( i = 0; i < SIZE; i++ ) {
printf( "%3d", a[ i ] );
}
printf( "\n" );
modifyArray( a, SIZE );
printf( "The values of the modified array are:\n" );
for ( i = 0; i < SIZE; i++ ) {
printf( "%3d", a[ i ] );
}
}
void modifyArray( int b[], int size )
{
int j;
for ( j = 0; j < size; j++ ) {
b[ j ] *= 2;
}
}
Non riporta l'indice ma SIZE. Non è lo stesso ?? (il libro non è per niente chiaro in questo punto). Perchè poi in altri esempi chiamata (...), prototipo (int...[]) e definizione (int...[]) hanno solo il nome del vettore tra parentesi?
Spero di essere stato più chiaro, scusa se ho fatto un po' di confusione