T
Tim
Why won't the declaration of a struct array work if I do it like this:
1 typedef struct
2 {
3 int pens;
4 int pencils;
5 } Stationers;
6
.........
7 int main(void)
8 {
9 int num;
...........num defined in code........
10
11 Stationers stats[num];
12 }
The error message says "constant expression required" and highlights
line 11. I want to declare it dynamically during runtime, could
someone explain how to do this please.
1 typedef struct
2 {
3 int pens;
4 int pencils;
5 } Stationers;
6
.........
7 int main(void)
8 {
9 int num;
...........num defined in code........
10
11 Stationers stats[num];
12 }
The error message says "constant expression required" and highlights
line 11. I want to declare it dynamically during runtime, could
someone explain how to do this please.