Question: Can you run me through this code. How does it compute that a number like 0x05 will return 0 while 0x35 will return 1. How

Can you run me through this code. How does it compute that a number like 0x05 will return 0 while 0x35 will return 1.

How does the following code return 1 if 0x30 <= x <= 0x39 and 0 otherwise.

Use 0x35, 0x3a and 0x05 for int x.

int isAsciiDigit(int x) {

int a = x<<6;

int b = x<<5;

int c = x<<4;

int d = x<<3;

int e = x<<2;

int f = x<<1;

return (!(a))&((b)) & (c) & (~(d) | (~(e) & ~(f)));

}

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!