Home » C Programming » Bitwise Operators :: Discussion
Discussion :: Bitwise Operators - Section 1
  1. Predict the output of following program.
    #include <stdio.h>
    #define MOBILE  0x01
    #define LAPPY   0x02
    int main()
    {
    unsigned char  item=0x00;
     item |=MOBILE;
    item |=LAPPY;
     printf("I have purchased ...:");
    if(item & MOBILE){
      printf("Mobile, ");
    }
    if(item & LAPPY){
      printf("Lappy");
    }
     return 1;
    }
  2. A.
    I have purchased ...:
    B.
    I have purchased ...:Mobile, Lappy
    C.
    I have purchased ...:Mobile,
    D.
    I have purchased ...:Lappy

    view answer View Answer

    discussion Workspace


Be The First To Comment