Thread: c programming

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    16

    c programming

    Hi!
    How do these operators work?
    Code:
    (<<, &, |, ~, ^)
    if we have:
    c1=5;
    c2=6;
    
    c3=c1 & c2 //?????
    c4=c1 | c2
    c5= c1 ^c2
    ..........

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    5 == 0101
    6 == 0110

    Code:
    so c3 = 0101
          & 0110
            -----------
            0100
             = 4
    
    c4 = 0101
       | 0110
         ---------
         0111
           = 7
    
    c5 = 0101
        ^0110
         -----------
         0011
           = 3

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed