Solution = Because of limit of char size that is 0-255,it happen that is
after 255 it goes again to 0 by either going to 256 and in revolving in
loop....
And after giving size it wrk fine..
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
On Sat, Aug 7, 2010 at 6:36 PM, h4nnibal <[email protected]> wrote:

> #include<cstdio>
> using namespace std;
>
>
> int
> main(int argc,char* argv[])
> {
>   for(unsigned char i=0;i<=255;i++){
>     if(i==255){
>       printf("\nASCII[%d]:=%c\n",i,i);
>       break;
>     }
>     printf("\nASCII[%d]:=%c",i,i);
>   }
>   return 0;
>
> }
>
>> > Here's a wierd situation..
>> >
>> > unsigned char c;
>> > for(c=0;c<=255 ; c++)
>> >      printf("%c",c);
>> >
>> > the above code gives an infinite loop in C !!!
>> >
>> > whereas, if i print
>> >
>> > unsigned char c=255;
>> > prinf("%c",c);
>> >
>> > the code works fine...
>> >
>> > Somebody , help me get a work around,
>> >
>> > Thanks and Regards,
>> > Shoubhik Bose.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-code%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" 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/google-code?hl=en.

Reply via email to