Objective-C global array of ints not working as expected
- by Fran
In my MyConstants.h file... I have:
int abc[3];
In my matching MyConstants.m file... I have:
extern int abc[3] = {11, 22, 33};
In each of my other *.m files... I have
#import "MyConstants.h"
Inside 1 of my viewDidLoad{} methods, I have:
extern int abc[];
NSLog(@"abc = (%d) (%d)", abc[1], sizeof(abc)/sizeof(int));
Why does it display "abc = (0) (3)" instead of "abc = (22) (3)"?
How do I make this work as expected?