-
INTs for array size
If I delcare: int size=0; and: char sfiles[size][104]; as gobal varibles when i come to compile the code my compiler says "Variable-size type declared outside of any function".
It works if I put it in a function but i need them to be gobal variables. because lots of funtions use them.
Can someone please help?
-
>>int size=0; and: char sfiles[size][104];
So, you've actually defined an array with 0 rows?!
Under c89, dynamic array sizing isn't allowed either, although it's permitted under c99.
Try using define's:
Code:
#define ROW 20
#define COL 20
char sfiles[ROW][COL];
-
Is there a way of incresaing the value of #define ROW 20 by 1
-
I presume you mean at runtime? Only by dynamically creating the array in the first place.