Complete the resuts assignment statement with a C expression

Complete the resuts assignment statement with a C expression to toggle bit 22 of target.

int main()

{

unisgned int target = 0x89abcdef;

unisnged int results;

results = ???;

return 0;

}

What value in hex is assinged to the variable results?

Solution

#include <stdio.h>

int main(void)
{
   unsigned int target = 0x89abcdef;
unsigned int results;
  
results = target ^ 1 <<22; // this will toggle bit 22 in 1000 1001 1010 1011 1100 1101 1110 1111
// 1010 becomes 1110 so a becomes e
printf(\"%0x \",results);
   return 0;
}

output:

Complete the resuts assignment statement with a C expression to toggle bit 22 of target. int main() { unisgned int target = 0x89abcdef; unisnged int results; re

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site