Add C pointer to NSMutableArray

Posted by Georges Oates Larsen on Stack Overflow See other posts from Stack Overflow or by Georges Oates Larsen
Published on 2012-04-13T05:07:22Z Indexed on 2012/04/13 5:29 UTC
Read the original article Hit count: 250

I am writing an Objective-C program that deals with low level image memory. I am using ANSI-C structs for my data storage -- Full blown objects seem overkill seeing as the data I am storing is 100% data, with no methods to operate on that data. Specifically, I am writing a customizable posterization algorithm which relies on an array of colors -- This is where things get tricky. I am storing my colors as structs of three floats, and an integer flag (related to the posterization algorithm specifically). Everyhting is going well, except for one thing...

[actual question]

I can't figure out how to add pointers to an NSMutableArray! I know how to add an object, but adding a pointer to a struct seems to be more difficult -- I do not want NSMutableArray dereferencing my pointer and treating the struct as some sort of strange object. I want NSMutableArray to add the pointer its self to its collection. How do I go about doing this?

Thanks in advance,

G

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about pointers