C doubt
- From: sangeeta chowdhary <sangitachowdhary@xxxxxxxxx>
- Date: Tue, 6 Jul 2010 02:23:52 -0700 (PDT)
#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
.
- Follow-Ups:
- Re: C doubt
- From: Francois Grieu
- Re: C doubt
- Prev by Date: C doubt
- Next by Date: Re: Convert UTC seconds to actual time.
- Previous by thread: Re: Please use meaningful subject lines [was: C doubt]
- Next by thread: Re: C doubt
- Index(es):
Relevant Pages
|