[gcj] Re: problem printing the 256th ASCII character in C

2010-08-04 Thread Shoubhik
Hi Gustavo, you are right, the 2's complement system can actually be represented diagramatically using a cyclic diagram...( i still remember seeing it in Computer Organisation,Hamacher). :-) well, the following snippets could be used to print 256 ASCII characters then.. 1) char c; for(c=-127

Re: [gcj] Re: problem printing the 256th ASCII character in C

2010-08-04 Thread Gustavo Pacianotto Gouveia
i think he just said that it is a cyclic data type because of the similarity of the two's complement notation (not that char uses it) to a clock. I thinks there's some book that uses this similarity to explain how it works... as far as i know python has biginteger implemented by default... but I'm

[gcj] Re: problem printing the 256th ASCII character in C

2010-08-04 Thread Shoubhik
Hey Thanks a lot to all of you, I got your point.. Have a good day! 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 google-c...@googlegroups.com. To unsubscribe from this

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Bharath Raghavendran
I don't think its reasonable to call something as a cyclic data type when it is not intended to be. Its just that the data type shows cyclic behaviour due to size limit. Its not a feature. float does not show this behaviour because its probably unable to handle more than 7 significant digits. So,

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Soumyorup Dey
*try unsigned long char *$ŎǕмџόЯטּρ δεЎ Connect with me on : [image: Facebook][image: Twitter] [image: Orkut][image: MySpace]

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Bartholomew Furrow
> > There is no such thing as cyclic data type. Its just that every data type > has limited size (1 byte for unsigned char). I think it's reasonable to talk about a cyclic data type -- it isn't a standard term as far as I know, but certainly there are data types that cycle under incrementation (c

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Bharath Raghavendran
Fundamental datatypes like int, char, long, etc are limited by size and hence, same thing will happen. There may be some custom datatypes like BigInteger that adjusts its size according to the value it stores and hence will be an exception to this. You need to search from net and download those lib

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread BABA SANUP @NITRKL
thank you for enlightening mein this regard and clearing my notion but is there any data type which is an exception to this rule? -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-c...@googlegroups.com

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Bharath Raghavendran
There is no such thing as cyclic data type. Its just that every data type has limited size (1 byte for unsigned char). 1 byte = 8 bits When it is storing 255, its binary will be "". When you increment it now, it tries to store "1", but since its limited to 8 bits, it becomes "

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread ayman bs
Bharath, I think the same, and here is a proof. http://ideone.com/jUcdS On Wed, Aug 4, 2010 at 7:05 PM, Bharath Raghavendran wrote: > I think when you do c++ from 255, it will go to 0 and not 256 (bcoz its > unsigned char). > Hence, the condition c<=255 is always satisified and its an infinite l

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread BABA SANUP @NITRKL
so u want to say that char is also a cyclic data type as integers, then it is perfect solution to the above riddle -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-c...@googlegroups.com. To unsubscrib

Re: [gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Bharath Raghavendran
I think when you do c++ from 255, it will go to 0 and not 256 (bcoz its unsigned char). Hence, the condition c<=255 is always satisified and its an infinite loop -Bharath On 4 August 2010 10:02, Shoubhik wrote: > > Hi, > > Here's a wierd situation.. > > unsigned char c; > for(c=0;c<=255 ; c++)

[gcj] problem printing the 256th ASCII character in C

2010-08-04 Thread Shoubhik
Hi, 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 Bos

[gcj] Re: Digest for google-code@googlegroups.com - 3 Messages in 2 Topics

2010-08-04 Thread Shoubhik
what about the others who couldn't make it to the finals :-( -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-c...@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubs