void main() { int a=903; char *ptr=(char*)&a;

void main()
{

int a=903;

char *ptr=(char*)&a;

printf("%d",*ptr++);

printf("%d",*ptr);

}

 

 

 

 

6Comments
Nishant Vijayvergiya @nishantv
6 Jan 2015 11:57 am

-1213

Arul @innovwelt
6 Jan 2015 02:05 pm

it is dependent on Endian format. we cannot say it for sure.

my machine is Little Endian. So, it gives -121 3.

In Big Endian machine, It could give 3 -121. I have not tested it though

Nishant Vijayvergiya @nishantv
6 Jan 2015 11:35 pm

I have tested it on my machine

Arul @innovwelt
6 Jan 2015 11:49 pm

mostly, our PCs are using Intel processors. and they follow Little Endian format.

but the concept is real.

Nishant Vijayvergiya @nishantv
6 Jan 2015 11:50 pm

okay

Amar Kumar @banti4uall
7 Jan 2015 03:02 am

35 an 3

Pages