Question: written in C: 6. (10 points) Write a function void paritize (void *p, unsigned int num_bytes); that accepts a void pointer that points to an
written in C:

6. (10 points) Write a function void paritize (void *p, unsigned int num_bytes); that accepts a void pointer that points to an array of bytes in memory along with the number of bytes the pointer points to, and (1) for each byte, the function computes its parity bit. For a given byte, the parity bit p is 1 if the number of l's in the first 7 bits (i.e., if a byte were b7b6b5b4b3b2b1bo then be through bo are the first 7 bits) is odd, or 0 if the number of ls is even. Then (2) the function replaces the most significant bit (i.e., bit b7) in the byte with the parity bit. Sample input and expected output: num_bytes byte-array that p points to (before calling paritize) in Hex deadbeef byte-array that p points to (after calling paritize) in Hex de2dbe6f 0 4 1 0 1 1 81 12345678deadc0de 8 12b45678de2dc0de 6. (10 points) Write a function void paritize (void *p, unsigned int num_bytes); that accepts a void pointer that points to an array of bytes in memory along with the number of bytes the pointer points to, and (1) for each byte, the function computes its parity bit. For a given byte, the parity bit p is 1 if the number of l's in the first 7 bits (i.e., if a byte were b7b6b5b4b3b2b1bo then be through bo are the first 7 bits) is odd, or 0 if the number of ls is even. Then (2) the function replaces the most significant bit (i.e., bit b7) in the byte with the parity bit. Sample input and expected output: num_bytes byte-array that p points to (before calling paritize) in Hex deadbeef byte-array that p points to (after calling paritize) in Hex de2dbe6f 0 4 1 0 1 1 81 12345678deadc0de 8 12b45678de2dc0de
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
