So, with this I make a VLA:
int main()
{
const size_t LEN = 200; // as I know it's read-onlyy
int array[LEN];
}
So I enstablished that VLAs are not more requested in C1.. In the C99 today they are optional... For this motivaiton, to use that code is not advised.
But if I do this:
#define MYLEN 100
int main()
{
int xar[MYLEN];
}
or
int main()
{
int xar[100];
const size_t MYLEN = sizeof(xar) / sizeof(int);
}
I think I have:
- In the first case I have a constant variable in the compile time, but it's more logic and not typed.
- In the second case, a typed variable, (read-only)
But with it's more valid with the define directive as it's typical to C language.What do you suggest to use?
Anyway, the VLA can be used inside the main but it has not so sense.