I'm trying to declare and initialize global C-variables.
const int numberOfTickMarks = 6;
const double tickValues[numberOfTickMarks] = {500, 2000, 3000, 4000, 6000, 8000};
When I do this in my header file (before the @interface
), I get a linker error. But when I do this in the .m
file (before @implementation
), things seem to work as desired.
Is the latter the accepted way to declare global constants for C/Objective-C?