New to c++ (as of last night), but I've used c# a bit.
I'm trying to take a variable from a user and create an array of that size: the problem I'm running into is that c++ wants all arrays as constant sizes. I have no intention of trying to change the size of the array once its created, but i cant seem to even create it, because I haven't initialized it with a constant number.
This is the code I tried using:
int a;
cin >> a;
const int b = a;
int c[b];
I was attempting to get around the constant issue, but that doesn't work. The other option presented was vectors, but that seems inefficient (as they are comparable to lists in c#?). I don't need to be able to change the size of the array or anything similar. Am I missing something obvious here?
Thanks