I\'m having a bit of a confusion on how to assign a value to a BOOL pointer? Here\'s my code:
- (void)locationManager:(CLLocationManager *)manager didUpdateT
Could be that you should write
*initialBroadcast = YES; // Where I'm having troubles
The line before seem to be a standard check to see that the pointer is valid (not nil)
Change -
initialBroadcast = YES;
to
(*initialBroadcast) = YES;
Since, you are assigning value to the location the pointer points to( assuming it is initialized ), initialBroadCast
should be dereferenced first.
You need to say
*initialBroadcast = YES;
initialBroadcast is a pointer aka memory address. The * gives access to the value at the memory address that the pointer holds. So initialBroadcast is a memory address, but *initialBroadcast is a boolean or char.
The problem isn't the assignment, it is much more likely that you declared your instance variable to be BOOL *initialBroadcast;
.
There is no reason to declare the instance variable to be a pointer (at least not unless you really do need a C array of BOOLs).. Remove the * from the declaration.
As well, that will fix your currently incorrect if() test. As it is, it is checking to see if the pointer is set, not the value.