samedi 23 mai 2015

Array prints just zeros

I have created an array with random numbers, but when I printf the array they are all 0, what is wrong here? I know that the random numbers are there, but still zeros?

int superArray[SIZE];
int index, counter;

srand( time(0) );

for (index = 0; index < SIZE; index++)  //random numbers

    superArray[index] = rand() % 21  +1;

for (index = 0; index < SIZE; index++)  //vertical print
{
    printf("%8.f\n", superArray[index]);
}
printf("%8d\n\n", superArray[8]); //verify that array has random numbers




Aucun commentaire:

Enregistrer un commentaire