From: Neil & Joey Obremski Newsgroups: comp.os.msdos.djgpp Subject: Re: For loop problem Date: Sun, 05 Apr 1998 20:00:16 +0000 Organization: CyCLONE7 Design Lines: 39 Message-ID: <3527E2CF.9CA3D179@nwrain.com> References: <3527FEA6 DOT 54FA AT vegas DOT infi DOT net> <3528041A DOT 36E2 AT vegas DOT infi DOT net> Reply-To: obremski AT nwrain DOT com NNTP-Posting-Host: 781 AT 205 DOT 134 DOT 220 DOT 159 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Why besides using an integer? Well, if you're going to use a byte then how about: unsigned char index = 0; do { printf("[%d]\n", (int)index); index++; } while (index); Simz wrote: > > Simz wrote: > > > > When ever I try to use a for loop in DJGPP with a char (or any type for > > that matter), the loop never stops when I try to loop to the max value > > that type can hold. For example > > > > unsigned char index = 0; > > unsigned char array[256]; > > for (index = 0; index < 256; index++) > > array[index] = index; > > > > This loop never stops, I've even tried.. > > for (index = 0; index <= 255; index++) > > for (index = 0; index < 256; ++index) > > for (index = 0; index <= 255; ++index) > > > > And I need all 256 iterations for my programs to work. > > Any sugestions? > > Besides using an integer. -- /----------------------[nobremski AT hotmail DOT com]----------------------\ ( Neil C. Obremski Ashrak DeadEye ) \-----------------[http://www.nwrain.com/~deadeye/]-----------------/