samedi 28 février 2015

return all the values in a function



This is probably an easy one but my brain is fried from all this. For the function below i want to return all the rocks that are equal to 2 and not just the first one. This just prints the first rock thats equal to 2 it finds. Thanks in advance



void view_drilled_rocks()
{
int i;
for (i=0;i<totalRocks;i++){
if (rocks[i].rock_completed==2){
printf("Rock No. Geoligist Drill(Y/N) Due date or comp date\n");
printf("%d \t %s \t %d \t%s", rocks[i].rock_rover_number, rocks[i].geoligist, rocks[i].rock_completed , rocks[i].due_date);
return 0;
}
}

}



Aucun commentaire:

Enregistrer un commentaire