If you write a C++ function like
void readEmStar( int *arrayOfInt ) { }
vs a C++ function like:
void readEmSquare( int arrayOfInt[] ) { }
What is the difference between using [square brackets] vs *asterisk, and does anyone have a style guide as to which is preferrable, assuming they are equivalent to the compiler?
For completeness, an example
void readEmStar( int *arrayOfInt, int len )
{
for( int i = 0 ; i < len; i++ )
printf( "%d ", arrayOfInt[i] ) ;
puts("");
}
void readEmSquare( int arrayOfInt[], int len )
{
for( int i = 0 ; i < len; i++ )
printf( "%d ", arrayOfInt[i] ) ;
puts("");
}
int main()
{
int r[] = { 2, 5, 8, 0, 22, 5 } ;
readEmStar( r, 6 ) ;
readEmSquare( r, 6 ) ;
}