Question: Type the following program : #include #define Mask1 0x04 #define Mask2 0xFE int main(void) { unsigned char Port0=0x01,Port1=0x03; Port0=Port0|Mask1; Port1=Port1&Mask2; printf(Port0:%x,Port0); printf(Port1:%x,Port1); return 0; }

Type the following program :

#include

#define Mask1 0x04

#define Mask2 0xFE

int main(void)

{

unsigned char Port0=0x01,Port1=0x03;

Port0=Port0|Mask1;

Port1=Port1&Mask2;

printf("Port0:%x",Port0);

printf("Port1:%x",Port1);

return 0;

}

1. what is the binary representationsfor the Port0,Port1,Mask1, and Mask2 values?

2. what are the binary representation for Port0 and Port1 after the bit manipulations?

3. what is the puprose of the bitwise and operator?

4. what is the purpose of the bitwise or operator?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!