y r we taking 8 bit numbers, i mean dat way we cant go beyond -127 to 127? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering
On Sun, Aug 7, 2011 at 5:39 PM, Yasir <[email protected]> wrote: > let say a=6; binary= 0000 0110 > b = ~a = 1111 1001 > Now when you print value of ~a or b, it is calculating 2's complement. > 1's complement: 0000 0110 > 2's complement: 0000 0111 (value = -7) > > Pls check signed bit representation for details. > > On Aug 7, 4:40 pm, Shashank Jain <[email protected]> wrote: > > bitwise complement operator (~), complements d digits of d input bt when > i > > use it : > > > > int a,b; > > b=~a; > > > > output: its giving o/p such that b= -a-1; > > > > why is dat so? > > > > Shashank Jain > > IIIrd year > > Computer Engineering > > Delhi College of Engineering > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
