Hi, I'd like to ask the user for a value, and then declare an array with that size. Like "char arrayName[value];" This doesn't seem to be possible however, as all declarations must happen before any other statements in the function or method. Is there any way go get around this? Of course I can create a very large array to be safe, but that's not efficient.
you can use malloc like this Code: char *arrayname = (char *)malloc(value); arrayname[0] = 'M'; OR in c++ Code: char *arrayname = new char[value]