On Mon, 10 May 1999, Chris Antos wrote:

> >popularity. Second, Microsoft's C++ compiler is a disaster. It doesn't even
> >know how to handle simple things like:
> >
> >for (int i=1; i<10; i++) { // do some stuff... }
> >for (int i=1; i<10; i++) { // do some other stuff... }

  hint of warning..
  
  standard C will not allow you to declare variables unless you
  are at a start of a block statement.

  i dont think standard C allows for (int i=0...) - Java does!

  why not do this:

  { 
    int i;
    for (i=1; i<10; i++) {
      // do some stuff
    }
  }

  {
    int i;
    for (i=1; i<10; i++) {
      // do some other stuff
    }
  }
 
  your declaration of 'i' is out of scope from each other.
  and it is more like "standard" C.

  putting extra { and } dont hurt your program !:)

  cheers.

az
--
Aaron Ardiri 
Lecturer                       http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 352 8192           A/H: +46 26 10 16 11

Reply via email to