C - Struct across multiple files

I'm having a problem reading and writing to structs across multiple files. Essentially I need to write to variables within a struct that are later checked during a timer interrupt. When this happens, the new timer value is taken as a member in that struct. At the moment I hard set these timer values in a while(1) loop, but later these values will be taken from some algorithm. I'm not quite sure if I'm doing this reading of struct members correctly. The project compiles, however during runtime, it sets the timers to random values. GDB degugging confirmed they are correct however.

The extern seems to have solved the problem of getting the struct across different files, and the initial value declaration of {10,10,10} has, I think solved some memory allocation problem. The code compiles, but doesn't hold correct values without it. I don't know what volatile does yet, no difference if I remove it. Something I shall read up on.

It appears to me that your timer_IRQHandler is called in the kernel as an interrupt routine. If true, main is probably never called.

I would try to statically initialize your struct, rather than rely on main to initialize it. For example:

myStruct hello = { 10, 43, 98 };

and yes, if multiple files reference it you should declare it as extern in the header and define/initialize it only once in a source file.

As for volatile, that's for device registers or memory-mapped addresses that might not give the same answer if read twice. It tells the compiler to not try to optimize out multiple reads for that memory location.