Original Post
Trying to load in a RGB raw file that I don't know the size of (though it is square and a power of two). This is what I got to declare the array and read the data. This seems to be loading my image in (512x512 won't load, but thats another question) as I can save it to disk and it seems to be fine. The problem is with the int y, the program crashes and says memory can't be "read". I'm reading in a height map and trying to smooth it out. Am I not indexing it right? Or am I not allocating the memory for the array right? But then I wouldn't think I would be able to place a copy back to disk.
map = (byte **)malloc(width);
for (int i=0; i<height; i++)
map = (byte *)malloc(width*3);
fread(map, 1, width*height*3, fp);
fclose(fp);
int y = map[0][0];