Exit a function
here's what i have...
its followed by another input function...i want to exit this function and stop the program if its not a valid year...i used exit (0); but it gives a warning .. of warning C4013: 'exit' undefined; assuming extern returning int ....i just want to exit and not continue if the condition is true...
void header (void)
printf("Enter the year (21st century): ");/*Asks user for the year*/
if (year > 2100 || year < 2001) /*if not a valid year give error*/
printf ("Calendar unavailable for invalid years.\n");/*print error*/
include stdlib.h for exit
I think a better option would be to return an int value. That way you can choose some sort of error routine instead of aborting. Your user most likely won't run your program too many times if he or she has to keep restarting it to enter a valid year. Just an idea.
Thanxguys...that worked...i'm such a n00b in C