Question: Please explain the codes in each line (226-232). Pointer Lab in C language * * * * 210 * Return 1 if the addresses stored
Please explain the codes in each line (226-232). Pointer Lab in C language
* * * * 210 * Return 1 if the addresses stored in ptr1 and ptr2- are within the 211 * *same* 64-byte aligned block of memory. Check the spec for examples if you are 212 * confused about what this means. Return zero otherwise. 213 * Operators / and % and loops are NOT allowed. 214 * 215 * ALLOWED: 216 Pointer operators: *, & 217 Binary integer operators: -, +, *, >, ==, ^ 218 Unary integer operators: !,^ 219 Shorthand operators based on the above: ex. =, *=, ++, --, etc. 220 221 * DISALLOWED: 222 Pointer operators: [] (Array Indexing Operator) 223 Binary integer operators: &, &&, I, II, , !=, 1, % 224 Unary integer operators: - 225 */ 226 int withinSameBlock(int * ptri, int * ptr2) { 227 228 // Your code here 229 230 long int a = (long int)ptri; 231 long int b = (long int)ptr2; 232 return !((~(b>>6) +1) + (a >> 6)); 233 234 } * * *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
