What I'm trying to output is the dealer's roll (the numbers are supposed to be stored in an array) but I keep getting an error that int is an invalid type in DealerRoll(dealerRoll[3]);
#include <iostream>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
//Dice Rolls
int DealerRoll(int dealerRoll[3]) {
srand (time(NULL));
for (int dealerCount = 0; dealerCount < 3; dealerCount++) {
dealerRoll[dealerCount] = rand()% 6+1;
cout << dealerRoll[dealerCount] << " ";
}
return dealerRoll[3];
}
int main() {
int dealerRoll;
cout << "Dealer's Roll: " << endl;
DealerRoll(dealerRoll[3]);
system ("pause");
return 0;
}
return dealerRoll[3];is returning an int that is outside the array, The largest indexed element indealerRollisdealerRoll[2]