1 question:

10 in binary is 1010, but this gives me output -6, shouldn't it be -2?Code:#include <stdio.h> struct foo{ int a:4; }; int main(void){ struct foo s; s.a=10; printf("%d\n",s.a); getchar(); return 0; }

the forth digit of 10 in binary is 1 that means the result will be <0, the remaining part of this is 010 which is 2, so why does it give me -6 instead of -2?

2 question:

but if we haveCode:int x=0; int y=++x; // y=1 and x=1 int x=0; int y=x++; //y=0 and x=1

why is x here 1??? I mean 0!=1 right? I can't get itCode:y=0; x=y==++y;

alsohere x is 0?? Why?Code:x=y==y++;

thanks in advance