The bitmap in memory looks something like this:
struct Image {
int width;
int height;
char *data;
}
struct Image theImage;
theImage.width = 100;
theImage.height = 100;
theImage.data = malloc(sizeof(char) * theImage.width * theImage.height);
Regarding import and export, there are some really simple file formats, see BMP . For more complex formats, it is best for you to use an already available library.
Most frameworks already have load / save methods for the most common file formats. You can take a look at the SDL if you are looking for a lightweight library.