C doubt



#include<stdio.h>
#include<string.h>

int main()
{
unsigned char i=0x80;
printf("%d %d\n",i<<1,sizeof(unsigned char));
return 0;
}

output of this code is 256 1

binary conversion of i is 10000000
now if shift it to left by 1,then ishould get zero,as there is only 8
bits available for i.
why i am getting 256.
range of unsigned char is from 0 to +255
.



Relevant Pages