www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/05/19:17:13

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: For loop problem
Date: Sun, 05 Apr 1998 15:59:11 -0700
Organization: Alcyone Systems
Lines: 23
Message-ID: <35280CBF.FA7634A@alcyone.com>
References: <3527FEA6 DOT 54FA AT vegas DOT infi DOT net>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Simz wrote:

> unsigned char index = 0;
> unsigned char array[256];
> for (index = 0; index < 256; index++)
>         array[index] = index;

Iterate with something other than a char.  An unsigned char can hold
values between 0 and 255 inclusive, so these conditions will _always_ be
satisfied.

    int index;

    for (index = 0; index < 256; index++)
        ...

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm:+37.20.07/-121.53.38
                                     \
        "I've got the fever for the / flavor of a cracker"
                                   / Ice Cube

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019