I've done quite a bit of research on how to set an arrays size using a variable of datatype int
, but haven't been able to find anything of use.
So here is an example of what I've tried in which gives me an error saying "expression must have a const value"
char * charptr = "test";
int sze = strlen(charptr);
char str[sze];
Sorry if this question is idiotic, I'm still quite new to c++
Any help will be appreciated though!