Question: Suppose we have the following code: int x = 0 x 1 2 3 4 5 6 7 ; char * p = ( char

Suppose we have the following code:
int x =0x1234567;
char *p =(char *)&x;
int y =(int)(*p)
printf("Value of y =%d", y);
Assuming size of int is 4 bytes, what will be the value of y that will be printed by the print statement for the following two scenarios:
a) if the code is run on a little endian machine
b) if the code is run on a big endian machine

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!