int x = 1231212;
memcpy(pDVal, &x, 4);
int iDSize = sizeof(double);
int i = 0;
for (; i<iDSize; i++)
{
char c;
memcpy(&c, &(pDVal[i]), 1);
printf("%d|\n", c);
printf("%x|\n", c);
}
I used above code segment to print the hex value of each byte of a Integer. But that is not working properly. What is issue here ?
pDValdeclared?std::cout << std::hex << x << std::endl;that will print the hex value ofx.