It looks wrong to me. I can't find the documentation for SOIL_load_image(), but I would guess that the correct way to check for an invalid return value would be
My bad, it looks wrong because I put only small chunk of the code that I don't undertsand, please see my updated question. The program is working fine. I just don't understand the *p==0 part
Sorry, I don't quite understand. I think checking *(p + 1) == 0 is just checking the green pixel value equals 0 or not (from range 0-255).
So, condition if(*p == 0 && *(p+1) == 0) is to check if green pixel value is 0 and *p==0, what is this *p==0 ?
Later in this code, there's also this condition if(*p == 255 && *(p+1) == 0), what's the *p in this condition ? is it also range from 0-255 ? But this is pointing to the image, not the RGB channel