'Get RGB of a pixel in stb_image

I'm created and loaded this image:

int x, y, comps;
unsigned char* data = stbi_load(".//textures//heightMapTexture.png", &x, &y, &comps, 1);

Now, how i'm get a RGB of a certain pixel of this image?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source