DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   runtime error while incresing the couter inside a loop (http://www.daniweb.com/forums/thread156198.html)

Srynx Nov 9th, 2008 9:06 am
runtime error while incresing the couter inside a loop
 
When I include i++; inside this loop I get a runtime error and I have no idea why I get it:
Do you have any idea?

 while (i <= 3){
       
          if (tauler[PacMan.y][PacMan.x]==0)
              xoc = 0;
          else if (tauler[PacMan.y][PacMan.x]==1)
              xoc = 1;
          else if (tauler[PacMan.y][PacMan.x]==2)
              xoc = 2;
          else
              xoc = 3;
             
       
        i++;
        PacMan.x += dx;
        PacMan.y += dy;
}

ArkM Nov 9th, 2008 9:59 am
Re: runtime error while incresing the couter inside a loop
 
I can't crank an engine. Look at my car mark, please: it's a Crow Victoria.
Do you have any idea?

http://www.daniweb.com/forums/thread78223.html

ddanbe Nov 9th, 2008 10:20 am
Re: runtime error while incresing the couter inside a loop
 
What was the value of i before you went into the while loop?

Srynx Nov 9th, 2008 10:24 am
Re: runtime error while incresing the couter inside a loop
 
Solved,
tauler[PacMan.y + 1 ] is an invalid vaule.
Thanks to everyone who has helped.


All times are GMT -4. The time now is 3:58 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC