The C vs. C++ way
- by amc
Hi,
So I have to write a program that will iterate through an image and record the pixel locations corresponding to each color pixel that appears in it. For example, given
http://www.socuteurl.com/fishywishykissy
I need to find the coordinates of all yellow, purple, dark pink, etc pixels.
In C++ I would use a hash table to do this. I would iterate through the image, check each pixel's value, look up that value and either add to a vector of pixel coordinates if it were found or add a new entry to the table if the value were not already there.
The problem is that I may need to write this program in pure C instead of C++. How would I go about doing this in C? I feel like implementing a hash table would be pretty obnoxious and error-prone: should I avoid doing that?
I'm pretty inexperienced with C and have a fair amount of C++ experience, if that matters.
Thanks.