0

This error is shown while compiling(error is pointed to the last closing bracket of won function)-

error: control may reach end of non-void function [-Werror,-Wreturn-type].

here is my code for won()-

bool won(void)
{
    // TODO
    int i,j,c=1,k=0;
    for(i=0;i<d;i++)
    {
       for(j=0;j<d;j++)
       {
           if(board[i][j]==c)
           {
               k++;
               c++;
               continue;
           }
           else
           {
               return false;
           }
       }
   }
   if(k==((d*d)-1))
   {
       return true;
   }
}
1
  • it just means that you have not assigned any return value to your function
    – shaistha
    Commented Dec 28, 2017 at 10:50

1 Answer 1

1

Hmmm... where have I seen this before? Oh yeah.....

http://cs50.stackexchange.com/questions/2448/how-to-solve-control-may-reach-end-of-non-void-function-error

http://cs50.stackexchange.com/questions/1647/how-to-fix-control-may-reach-end-of-non-void-function-and-no-such-file-or-dir

Check these links. If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .