mercredi 17 août 2016

C++ Initializing a 2D array with random numbers

So I feel like an idiot, because I see how many questions have been asked about this, yet, I feel like I am missing the ball here.

I am trying to initialize my array in a function with random values, so I can (later) sort it.

static int a[10][100000]; //declared in int main()

void init(int arr[10][100000]) {
    for (int i = 0; i <10; i++){
        a[i] = rand();
        for(int k = 0; k < 100000; k++){
            a[k] = rand();
        }     
    }
}

any help would be appreciated




Aucun commentaire:

Enregistrer un commentaire