   Random Space Invaders segmentation fault
  Hey guys, I'm not entirely sure what the problem is here, but there seems to be a segmentation fault in my space invaders code.I've used the debugger to single it down to a nested loop in my code, can someone please point out what the problem is please?main.cppfor(int i = 0; i < 10; i++)   {  if(!tehShip.tehShots.dead)  { for(int j = 0; j < MAXENEMIES; i++) {if(enemylol[j].checkHit(tehShip.tehShots.position)){    tehShip.tehShots.dead = true;    enemylol[j].dead = true;} }  }   }the checkHit function is as follows:bool cEnemy::checkHit(SDL_Rect shotPos){    if(shotPos.x >= position.x && shotPos.x<= position.x + position.w )    {   if(position.y == shotPos.y)   {   return true;   }   if(position.y + position.h == shotPos.y)   {   return true;   }    }    return false;}the program segfaults on "enemylol[j].dead = true" for some reason.If anyone has any ideas then let me know! cheersHeh   
  The error on that line doesn't make sense or the checkHit method should also have segfaulted. Try a clean build. Sometimes compilers and linkers get confused when there are lots of incremental changes, perhaps the debugger is reporting the wrong line number?   ;  ahhh ok don't worry, I was being stupid =(I had this: for(int j = 0; j < MAXENEMIES; i++)I needed this: for(int j = 0; j < MAXENEMIES; j++)my bad!Cheers for the help though =)heh.   