You can not have static array which size is given as a variable
That’s why constants should be #define
d:
#define a 6
This way preprocessor will replace a
with 6
, making it valid declaration.
More Related Contents:
- C | Static array: why does writing out-of-bounds not result in exception? [duplicate]
- What is the purpose of static keyword in array parameter of function like “char s[static 10]”?
- Variably modified array at file scope
- Why can’t the size of a static array be made variable?
- Access element of array of pointer of structure
- Explanation of output of this C code
- whats the difference between dynamic memory allocation and normal memory allocation?
- Getting an error while running following code
- Finding target sum of two numbers in array
- Correctly allocating multi-dimensional arrays
- How to deal with symbol collisions between statically linked libraries?
- Array-size macro that rejects pointers
- How to initialize array to 0 in C?
- The initialization of static variables in C
- Freaky way of allocating two-dimensional array?
- c structure array initializing
- Why am I being allowed to use a const qualified variable as an array size in C?
- Pointer vs array in C, non-trivial difference
- Using Dynamic Memory allocation for arrays
- Array type char[] is not assignable [duplicate]
- Accesing a 2D array using a single pointer
- Is there any overhead for using variable-length arrays?
- C difference between *[] and **
- Finding out the duplicate element in an array
- Exceeding array bound in C — Why does this NOT crash?
- Find size of array without using sizeof
- Why won’t extern link to a static variable?
- How can I malloc a struct array inside a function? Code works otherwise
- problems with char array = char array
- C pointer notation compared to array notation: When passing to function