J
jon.harding
Hello, I am learning C so excuse me if this is a trivial question.
Here is some contrived code. It won't even compile with gcc. I need to
set a size of the int array at compile time. When I provide copies of
my code for evaluation, I want to set the dynamic size low. When I
provide copies of my code when someone buys it, I want to set the
dynamic size high (and recompile) and provide something more useful.
The line with baa1 is fine and when it is the only array in my struct,
it compiles fine. The lines baa2 and baa3 the compiler doesn't like.
Can someone advise of the syntax to dynamically size an array in a
struct at compile time with gcc/Ubuntu x86.
Thank you
Jon
#define TESTDYNAMICSIZE1 = 5
const testdynamicsize2 = 5;
struct foo1 {
int id;
int baa1[5];
int baa2[TESTDYNAMICSIZE1];
int baa3[testdynamicsize2];
};
int main(int argc, char *argv[]) {
return 0;
}
Here is some contrived code. It won't even compile with gcc. I need to
set a size of the int array at compile time. When I provide copies of
my code for evaluation, I want to set the dynamic size low. When I
provide copies of my code when someone buys it, I want to set the
dynamic size high (and recompile) and provide something more useful.
The line with baa1 is fine and when it is the only array in my struct,
it compiles fine. The lines baa2 and baa3 the compiler doesn't like.
Can someone advise of the syntax to dynamically size an array in a
struct at compile time with gcc/Ubuntu x86.
Thank you
Jon
#define TESTDYNAMICSIZE1 = 5
const testdynamicsize2 = 5;
struct foo1 {
int id;
int baa1[5];
int baa2[TESTDYNAMICSIZE1];
int baa3[testdynamicsize2];
};
int main(int argc, char *argv[]) {
return 0;
}