how can i have a return with my various if statements?

//function required to have a return.
char update(const char grid[][], int N, int Row, int Col, int ageGrid[][]){

int countB, countF, countR, countG;
if(grid[Row][Col] == 'Y')
{
if((countB + countF) > countR)
{
return 'E';
}
return 'Y';
}

if(grid[Row][Col] == 'I') // && neighborhood == ALIVE)
{
if(ageGrid[Row][Col] >= 5)
{
return 'E';
}

return 'I';
}
//required return
}
Last edited on
What do you think your function should return, if none of the if statements are true?

This is a design decision you should think about. How do you want your program to behave?
return should be a char
Yes, obviously, but what do you want the value of that char to be, if none of the if conditions in the function are true?
Topic archived. No new replies allowed.