Hi Guys,
This is my first post here. I have this code and it does everything i want to but prints a "ffffff" infront of the output for some reason. Can you let me know why it is doing that and how to get around it?
The code is:
Code:
#include<stdio.h>
void main() {
int j=51712,*y;
char a, *z;
y=&j;
printf ("Size of an Integer in UltraSPARC-IIIi is %d bytes\n", sizeof(j));
printf ("Size of a Character in UltraSPARC-IIIi is %d byte\n", sizeof(a));
printf ("Address of variable = %x\n", y);
printf ("--------------------------------------\n");
z=(char *)y;
printf ("Address\t\tValue\n");
printf ("--------------------------------------\n");
printf ("%x\t %02x\n", z, *z);
printf ("%x\t %02x\n", z+1, *(z+1));
printf ("%x\t %02x\n", z+2, *(z+2));
printf ("%x\t %02x\n", z+3, *(z+3));
printf ("Value of varible is %d and is %x in hex\n", j,j);
}
And the output is:
Size of an Integer in UltraSPARC-IIIi is 4 bytes
Size of a Character in UltraSPARC-IIIi is 1 byte
Address of variable = ffbffd54
--------------------------------------
Address Value
--------------------------------------
ffbffd54 00
ffbffd55 00
ffbffd56 ffffffca
ffbffd57 00
Value of varible is 51712 and is ca00 in hex
Now i dont know why it is prepending that "ffffff" infront of "ca"
Thanks for all the help
Thanks
Mike