c++ – warning: control reaches end of non-void function [-Wreturn-type]

c++ – warning: control reaches end of non-void function [-Wreturn-type]

You just need to return from the main function at some point. The error message says that the function is defined to return a value but you are not returning anything.

  /* .... */
  if (Date1 == Date2)  
     fprintf (stderr , Indicating that the first date is equal to second date.n); 

  return 0;
}

You can also use EXIT_SUCCESS instead of return 0;. The macro EXIT_SUCCESS is actually defined as zero, but makes your program more readable.

c++ – warning: control reaches end of non-void function [-Wreturn-type]

Leave a Reply

Your email address will not be published.