I want use a define to get the 4 bytes from an int
. How should I write this define?
int k = 4;
unsigned char byteK[4];
byteK[0] = (unsigned char)k & 0xFF;
byteK[1] = (unsigned char)((k >> 8) & 0xFF);
byteK[2] = (unsigned char)((k >> 16) & 0xFF);
byteK[3] = (unsigned char)((k >> 24) & 0xFF);