I have using the following code to set the Cache Size according to the User's Input
int size=1024;
Console::WriteLine("Select the Cache Size.\n a. 1 Kb \n b. 2 Kb \n c. 4 Kb \n d. 8 Kb\n");
String^ CACHE_SIZEoption = Console::ReadLine();
//Char wh=CACHE_SIZEoption->ToChar();
switch(CACHE_SIZEoption[0])
{case 'a':{
size= 1024;
break;}
case 'b':{
size=2048;
break;}
case 'c':{size= 4096;
break;}
case 'd':{size=8192;
break;}
default: {Console::WriteLine("Wrong Input");}
}
#define CACHE_SIZE size
long tags[CACHE_SIZE];
The error is produced on the last line, "long tags[CACHE_SIZE]"
expected constant expression
cannot allocate an array of constant size 0
Please tell if there is another way to do this thing