Uno sguardo alla guida ?
codice:#include <iostream> #include <cstdlib> using namespace std; void foo (int array[], unsigned int n); main () { int arr[10]; foo (arr, 10); for (unsigned int i = 0; i < 10; i++) cout << arr[i] << endl; cout << endl; return EXIT_SUCCESS; } void foo (int array[], unsigned int n) { srand((unsigned int) time(NULL)); for (unsigned int i = 0; i < n; i++) { array[i] = rand() % 3 + 1; } }