1 question:
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;
}
10 in binary is 1010, but this gives me output -6, shouldn't it be -2?
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:
Code:
int x=0;
int y=++x; // y=1 and x=1
int x=0;
int y=x++; //y=0 and x=1
but if we have
why is x here 1??? I mean 0!=1 right? I can't get it
also here x is 0?? Why?
thanks in advance