I need to do something like this:
sizeof(int[width][height][8])
but unfortunately in c89 (the standard i have to use) this notation is forbidden, is there any way to do the same thing but using pointer notation?
It works fine in c99 but not in c89
You can write this instead:
Make sure you put the
sizeof(int)
first to forcewidth
andheight
to be converted tosize_t
and avoid a potential integer overflow onwidth * height * 8
ifwidth
andheight
haveint
type.