program.c
//updates the status of each ship, 1 if still afloat, 0 if ship sunken (works)
updates the status of each ship, 1 if still afloat, 0 if ship sunken (works)
updates the status of each ship 1 if still afloat 0 if ship sunken ( works )
void updateShips(ship *pShips, ship *cShips){
  for(int i = 0; i < 3; ++i) {
    int pSpaces = 0, cSpaces = 0;
    for(int k = 0; k < pShips[i].size; ++k) {
      if(*(pShips[i].spaces[k]) == BOAT){
		++pSpaces;
	  }
    }
    if(pSpaces == 0){ 
	  pShips[i].status = 0;
	}
    for(int k = 0; k < cShips[i].size; ++k) {
      if(*(cShips[i].spaces[k]) == BOAT){
		++cSpaces;
	  }
    }
    if(cSpaces == 0){ 
	  cShips[i].status = 0;
	}
  }
}
void updateShips ( ship * pShips , ship * cShips ) { for ( int i = 0 ; i < 3 ; ++ i ) { int pSpaces = 0 , cSpaces = 0 ; for ( int k = 0 ; k < pShips [ i ] . size ; ++ k ) { if ( * ( pShips [ i ] . spaces [ k ] ) == BOAT ) { ++ pSpaces ; } } if ( pSpaces == 0 ) { pShips [ i ] . status = 0 ; } for ( int k = 0 ; k < cShips [ i ] . size ; ++ k ) { if ( * ( cShips [ i ] . spaces [ k ] ) == BOAT ) { ++ cSpaces ; } } if ( cSpaces == 0 ) { cShips [ i ] . status = 0 ; } } }
updates the status of each ship, 1 if still afloat, 0 if ship sunken (works)
updates the status of each ship 1 if still afloat 0 if ship sunken ( works )