Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main(void)
- {
- //Declare below a 8-bit unsigned number called foo
- foo = 0xAB;
- // Declare any additional variables if needed
- //Initialize foo to the hexadecimal value AB
- //Write code (possibly more than 1 line) to swap the
- // lower and upper 4-bits of foo; After executing your
- // statements foo should have the value BA in hex.
- // The following if-then-else statement
- // prints the success or failure of your swap code written above
- if (foo == 0xBA) {
- printf(“Output of Homework 2: Swap Successful”);
- else {
- printf(“Output of Homework 2: Swap Failed");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement