Hi everyone,
I have the following lines of code in front of me:
Code:
unsigned char (*image)[x_resolution][3];
image = malloc(x_resolution * y_resolution * sizeof(char[3]));
Where x_resolution and y_resolution are both 1000.
I noticed it is then possible to do something like this:
Code:
memcpy(image[0][5], "\0\0\0", 3);
What bugs me is that the array was declared as a two dimensional array with 1000 x 3 elements and yet we can can access elements that are seemingly out of bounds without trouble. I also understand that technically we're still within the bounds of the allocated memory, but still does this style make sense?
Thanks,
Omar