I'm working with a structure IMAGE_T
(shown below, excuse the French) with its own alloc function.
typedef struct {
int nbl; /* nombre de ligne de l'image */
int nbc; /* nombre de colonnes de l’image */
unsigned char **data; /* tableau bidim des pixels de l’image */
} IMAGE_T;
IMAGE_T *alloc_image(int nbl, int nbc){
int taille = nbl*nbc+100;
IMAGE_T * image;
image = (IMAGE_T *) calloc(taille, sizeof(unsigned char));
return image;
}
When going through the debugger, it bugs out stating: "unhandled exception at: 0xc0000005: access violation reading location 0x00000000." ..which I'm pretty sure relates to alloc_image not functioning properly. Any suggestions?
(And for further info, after declaring an IMAGE_T
I'm then use another function that returns IMAGE_T *
, which itself contains the function alloc_image
within it, in order to allocate the memory. Is there anything wrong with this?)
Thanks