Pls explain how it works...
Hi,
This is a program from my book. But no matter how i look at it i jsut couldn't figure out how it works. I think the purpose of it is to reverse the order of an array of numbers. But if possible, pls explain the program line by line, it's very short. But skip lines like #include and int main().
Thnx in advance.
Code:
#include <stdio.h>
#define SIZE 10
void someFunction( const int [], int );
int main()
{
int a[ SIZE ] = { 8, 3, 1, 2, 6, 0, 9, 7, 4, 5 };
printf( "Answer is:\n" );
someFunction( a, SIZE );
printf( "\n" );
return 0;
}
void someFunction( const int b[], int size )
{
if ( size > 0 ) {
someFunction( &b[ 1 ], size - 1 );
printf( "%d ", b[ 0 ] );
}
}