jeudi 7 novembre 2019

Why i am not able to copy unsigned char array to another unsigned array

I first copy a Pointer to unsigned char array.

 unsigned char* downsampleData is pointing to some value
 unsigned char OriginalData[SCR_HEIGHT * SCR_WIDTH * 4];
 memcpy(OriginalData, downsampleData, sizeof(OriginalData));

I can access the value of OriginalData and till this point everthing works as it should. Now i try to copy the Char array to another char array.

 unsigned char FeildData[SCR_HEIGHT][SCR_WIDTH * 4];

        int x = 0;
        for (int i = 0; i < SCR_HEIGHT ; i++)
        {
            for (int k = 0; k < SCR_WIDTH * 4; k++)
            {
                FeildData[i][k] = OriginalData[x]; // Program crashes at this point
                x++;
            }
        }

But The program crashes.

Aucun commentaire:

Enregistrer un commentaire