Merry Christmas everybody 🙂
I have a pointer problem. Although I´m familiar with pointer concepts I haven´t used pointers in Objective-C so far the way it´s described here.
I modified it like this:
int countSInteger = 10;
[self setHMSValues:countSInteger];
- (void) setHMSValues: (int*) timeCat {
*timeCat = *timeCat - 1;
}
But now I´receiving a EXC_BAD_ACCESS:

Any Santa hints?
It looks like you want
setHMSValues:to calculate and return a value for the integer parameter. However, the parameter is a pointer to an int (int *), and you’re passing a plainintwith the value of10. Because pointers are just integer values themselves (with the integer value representing a memory address), the code is trying to set the value at memory location10; hence, you get a “bad access” error because your program cannot access or change values at memory location 10.What you should do is pass the address of
countSIntegerto the method:However, there’s a better way to do this. Since you’re returning only one value from the method, there’s no need for an out parameter. You can change your method to this:
and call it like this: