Question: 7. (4 points) (Practice problem 2.5) Consider this program: #include int main() { int i=0x12345678 unsigned char *cp : cp = (unsigned char *) &i;

 7. (4 points) (Practice problem 2.5) Consider this program: #include int

7. (4 points) (Practice problem 2.5) Consider this program: #include int main() { int i=0x12345678 unsigned char *cp : cp = (unsigned char *) &i; printf("%x ", *cp); a. What is its output on a little endian machine? b. What is its output on a big endian machine? 8. (8 points) (Practice Problem 2.12) Write C expressions, in terms of the variable x, for the following values. Your expression must be correct for a machine with an arbitrary word size. The least significant byte is called "byte 0". Your solution must work for a machine with a word size that is in the range of 2-8 bytes 1. Byte 1 of 3 unchanged with all other bytes set to 0. 2. All bytes but byte 0 of complemented i.e., the least significant byte unchanged). 3. Byte 0 of changed to all ls with all other bytes unchanged. 4. Byte 1 unchanged but all other bytes complemented

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 Databases Questions!