Why would you shuffle the array, when you could simply scan it?



int array[40];
int i = 0;
int j;

while( i < 40 )
{ array[i] = (rand() % 40) + 1;