Write c expressions that evaluate to one


Write C expressions that evaluate to 1 when the following conditions are true, and to 0 when they are false. Assume x is of type int.
A. Any bit of x equals 1.
B. Any bit of x equals 0.
C. Any bit in the least significant byte of x equals 1.
D. Anybitinthemostsignificantbyteofxequals0.
Your code should follow the bit-level integer coding rules (page 120), with the additional restriction that you may not use equality (==) or inequality (!=) tests.


Problem 6. [20 Points]:
Assume you have a 16 bit machine with 65536 bytes of memory. Ints are 2 bytes in size. Assume that variables are placed in memory contiguously in the order they are coded, starting at memory address 0x100.
Note that the size of a pointer is determined by the size of your addressable memory space; you only need as many bytes as it takes to represent the maximum memory address.
Given the following code segment:
int x = 15; int y = 48;
int *px = &x; int *py = &y;
printf("a) %xn", px); printf("b) %xn", py);
px = py;
printf("c) %dn", *px); printf("d) %xn", &px);
x = 30; y = 35;
printf("e) %dn", *px); printf("f) %dn", *py);
Give the output of each printf statement. 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write c expressions that evaluate to one
Reference No:- TGS098764

Expected delivery within 24 Hours