Hi,
I have been defining variables within methods, an example would look something like:
I want to use this arrayofints outside the method, but there are errors when I put it anywhere else, partly because I am setting the variable.
I also tried creating a separate .h file (and even a .m) file as I would like to store the data separate and be acessible to other objects & methods within my program, but still getting errors.
Where would be the best place to locate such definitions?
Also curious regarding the use of a method as above, would this mean that each time the method is called, the definitions are redefined?
Thanks in advance
m1
I have been defining variables within methods, an example would look something like:
Code:
-(void)my_method{
const int arrayofints[]={1,2,3,4,5,6,};
/*other stuff */
}
I want to use this arrayofints outside the method, but there are errors when I put it anywhere else, partly because I am setting the variable.
I also tried creating a separate .h file (and even a .m) file as I would like to store the data separate and be acessible to other objects & methods within my program, but still getting errors.
Where would be the best place to locate such definitions?
Also curious regarding the use of a method as above, would this mean that each time the method is called, the definitions are redefined?
Thanks in advance
m1