Hi all, this is my first post and i'm a beginner in c programming,
i need help to understand what i'm doing wrong.
I'm not getting the expected result:
i'm getting the expected result through, with this piece of code:Code:... size_t size = sizeof(uint32_t); ... void *ret = malloc(size * width * height); if (ret == NULL) return 1; ... memcpy(ret + (y * width * size) + x, data + (y * width * size) + w, size); ...
but as the size is dynamic, i can't use this, and i really need something like the fist case.Code:... size_t size = sizeof(uint32_t); ... void *ret = malloc(size * width * height); if (ret == NULL) return 1; ... ((uint32_t *)ret)[y * width + x] = ((uint32_t *)data)[y * width + w]; ...
Thanks in advance, and sorry if my english is not the best.