The following program passes a temperature value and a humid…
The following program passes a temperature value and a humidity value to the “print_readings” function, which in turn prints the values. The program compiles, but outputs an incorrect value. The error is caused by one line of the program. Rewrite the line to fix the program. You do not need to identify the line number. #include void print_readings(unsigned char packed) { unsigned char temperature; unsigned char humidity; temperature = packed & 0xF0; humidity = packed & 0x0F; printf(“Temperature: %u\n”, temperature); printf(“Humidity: %u\n”, humidity); } int main() { unsigned char temperature = 9; unsigned char humidity = 6; unsigned char packed; packed = (temperature
Read Details