If your goal is to print the address where the data was loaded, that would be %p:
printf("Loaded file: %p\n", (void*)data);
If you want to print the actual data, byte by byte, you should loop over the bytes and use %hhu (for decimal) or %hhx (for hexadecimal):
printf("Loaded file:\n"); for(int i = 0; i < width*height*nr_components; ++i) printf("%hhx ", data[i]); printf("\n");
data doesn't contain the name of the file though, so if you want to print just the name, then print that same string that you passed to stbi_load:
const char *filename = "textures/height.png"; unsigned char* data = stbi_load(filename, &width, &height, &nr_components, 0); printf("Loaded file: %s\n", filename);
unsigned charorunsigned char*?datais defined as a pointer to anunsigned charpresumably it holds the address of the first element of an array ofunsigned charstbi_loaddoesn't return a string. It returns bitmap data. You can't print it like a string. The name of the file is presumablytextures/height.png.