View Single Post
  #8  
Old 05-10-2004, 08:05 AM
Sith_Lord
Fire Beetle
 
Join Date: May 2004
Posts: 5
Default

yeah, you defined it in the for loop when you said "int j;" basically that creates a variable called j inside that for loop. variable defiitions inherit downwards but not up - i.e. you coudlnt reference that j outside of the for loop, but somewhere above, i had already been defined, so that definition was inherited into the for loop, so you couldnt redefine it anywhere down-the-tree from where it was defined.

basically what the line you changed said was, this is a for loop . The condition at the start is that j is an int and equals 0; we run the for loop while ever j is less than 9 and at the end of each run through the loop j needs to be incremented. Then everything between the {}s is what needs doing each run thru. So yeah you could have used anything that wasnt already defined as long as everywhere in the loop you changed the j to be whatever.

sorry, a bit off topic

Luke
Reply With Quote