I have the following code in C which fails on compilation. I think I am missing something about the way array of structs work or about memory models or something else I am not aware of it.
#include <stdio.h>
#define BASE_YEAR 2013
struct struct_tpo_line {
int price;
char tpo_list[255];
int tpo_count;
};
struct struct_bar {
unsigned int open;
unsigned int high;
unsigned int low;
unsigned int close;
unsigned int flags_volume;
};
struct struct_bar data[20][12][31][24][60];
main() {
char filename[255];
struct struct_bar bar;
struct struct_tpo_line array1[10000];
printf("20030101 193200;1.048400;1.048500;1.048300;1.048500;0\n");
bar = data[2013 - BASE_YEAR][1 - 1][1 - 1][19][32];
printf("%d %d %d %d\n", bar.open, bar.high, bar.low, bar.close);
printf("Hello World.\n");
}
I try to compile it under Windows 10 32 bits Home using Digital Mars C compiler and I get:
C:\Users\...\DATA>dmc test2.c -o test2.exe
link test2,test2,,user32+kernel32/noi;
And the following popup:
I was previously using PCC compiler but I changed to Digital Mars as I thought it might be compiler-related issue.