Question
Need help with C homework please. Write a function called set_byte. It is passed 3 parameters: a pointer to an unsigned long x, an index
Need help with C homework please.
Write a function called set_byte. It is passed 3 parameters: a pointer to an unsigned long x, an index i, and a new value v for the byte.The function should change the ith byte of x to v. Byte 0 is x's least significant byte; byte 1 is the next least significant byte, etc.; byte 7 is x's most significant byte. You may only use the constants 0-255 in this function, and must restrict yourself to the the assignment operator, the dereferencing operator, multiplication, bitwise operators and shift operators.
void set_byte(unsigned long *xptr, int i, char v) {
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started