Hello
I am using CCS v6 and LCDK6748.
I have an struct with two int and a pointer to an array.
When I initialize the struct, I write the int with some data and I reserve the space for the array with malloc.
Then I try to fill the array, but when i try to read the array is empty.
I debug my code and the array shows this:
Error: Memory map prevented reading 0x00000000.
Could you help me??
What is wrong??
This is the code:
//The struct
struct OO {
int ancho;
int alto;
unsigned char *imagen;
};
//the function to initialize
int CrearG(struct OO *oo, int ancho, int alto)
{
oo->ancho=ancho;
oo->alto=alto;
oo->imagen=(unsigned char *)malloc(((oo->ancho)*(oo->alto))*sizeof(unsigned char));
return 1;
}
//In the main
for(i=0; i<oo->ancho*oo->alto; i++)
{
OO->imagen[i]=(unsigned char) i;
}
Thank you
Kind Regards