Never call main in another function. This is not how it works.
If the called function (correct()) is done it will automatically return to the calling function (main()). You could do something like this:
Code:
#include <stdio.h>
int correct()
{
char buf[BUFSIZ];
printf( "Well Done. You guess the correct number\n" );
printf( "Do you want to try again? (y or n): " );
/* I always use fgets to read from stdin */
/* read a complete line from stdin */
if(fgets(buf, BUFDIZ, stdin) == NULL)
return 1;
/* check first character */
if(buf[0] == 'y' || buf[0] == 'Y')
return 0;
else
return 1;
}
int main(void)
{
int done = 0;
while(done == 0)
{
...
done = correct();
...
}
return 0;
}