UPDATE The question was edited after I posted this answer. In its current form, the size of the array is not known at compile time. This requires either using a VLA (and figuring out where that error message is coming from), using malloc, or allocating a constant-size array that's big enough for any expected use and using only the initial portion of it. The following applies to the question as it was originally written.
C90 required the length of an array to be a constant expression (something that can be evaluated at compile time). C99 introduced variable length arrays. C11 made VLAs optional.
Your code is invalid in C90, valid in C99, and conditionally valid in C11.
But given what you've shown us, you don't need a variable length array.
You have:
int totalSize = 8;
char totalString[totalSize];
totalSize is not a constant. (And defining it as const wouldn't make it a constant, for complicated reasons I won't go into.) But the size of your array is always going to be 8.
You can just write:
char totalString[8];
but that's poor style. It can make it difficult to determine just what you have to modify if your requirements change.
You can do this:
#define TOTALSIZE 8
char totalString[TOTALSIZE];
(The convention is to use all-caps for macro names.)
Or you can play this trick with an enum to create a named constant of type int:
enum { TotalSize = 8 };
char totalString[totalSize];
Or, possibly, you can keep your code as it is (I'd add a const to the definition of totalSize if its value should never change) and figure out why you're getting that diagnostic message. You haven't told us what compiler you're using, or whether the message is from the compiler or some other tool. You certainly don't need a VLA in this context, but you might still be able to use one.
malloc()et all.int totalSize = 8;) but is no longer applicable.