We can't just give you code for this: it will depend on what image type you are trying to read:
.JPG internal format is totally different from .BMP for example.
C does not have the high-level routines to read an image file - you have to read the file format and process it yourself.
Reading the file is easy:
FILE *input;
char get_char;
input = fopen("myimage.bmp", "rb");
while((get_char=fgetc(input))!= EOF)
{
...
}
fclose(input);
Reads a file a byte at a time.
You will need to Google for the file format, and process it accordingly.