How do I go about fixing these three errors?
- error C2057: expected constant expression
- error C2466: cannot allocate an array of constant size 0
- error C2133: 'randomTickets' : unknown size
Line that's having the issue and not liking [tickets]
int randomTickets[tickets][SIZE];
//global constants
const int SIZE = 6; //This is the number of balls per ticket
const int MAX_WHITE = 58; //This is the range of the white balls
const int MAX_RED = 34; //This is the range of the red balls
const int waysToWin = 9;
int* newAr = new int[SIZE];
int main(int argc, const char * argv[])
{
int tickets = displayMenu(); //Welcome screen lets you buy tickets
int spending = tickets * 2; //Charges you for the tickets
int randomTickets[tickets][SIZE];
//code
Thanks in advance for your help!
ticketsa constant expression and make sure it's value is greater than zero.tickets.) Is it that you don't know what a constant expression is?std::vector<std::array<int,SIZE>> randomTickets(tickets);(and +1 for Raymond's comment).