in my program i am getting my receiving data from sensors in uint8_t type. I need to store those data in a NSMutable array.
i created a NSMutable array
NSmutableArray *test;
initialize it
test = [[test alloc]init];
Then i tried to store data in my array
[test addObject:Message.data7];
Message.data7 is in uint8_t format
But it want allow me to store like that way ,
Can any one explain me how to do that.
thanks in advance
You can't store simple primitives in NSArray
/NSMutableArray
. However, you can convert it to a NSNumber
and store that:
[test addObject:@(Message.data7)];
When you want to retrieve the value from the array:
uint8_t value = (uint8_t)[test[index] unsignedCharValue];