Can anyone tell me what is going on in this code:
It was supposed to split a short into bytes but instead output the letters A to Z.Code:int main()
{
unsigned short shortint = 0x4041;
unsigned char *output = (unsigned char *) shortint + NULL;
for (int i=0; i<26; i++)
{
unsigned char chr = (unsigned char) &output[i];
if (chr == NULL)
{
cout << "NULL" << endl;
break;
}
else
cout << i << " = " << chr << endl;
}
}