"John Smith" <js****@company.com> wrote in message
news:e0********************@twister.southeast.rr.c om...
I want the program to jump to the beginning of the main() if in a
function a certain error is detected. What's the best way to
handle this?
"Best" is a subjective term. But consider:
#include <stdio.h>
int func(int arg)
{
if(arg < 0)
return 0;
else
return 1;
}
int main()
{
int i = -2;
/* 'beginning of main()' */
while(!func(i))
printf("func(): invalid argument (%d)\n", i++);
printf("func(): argument (%d) OK\n", i);
return 0;
}
-Mike