At the end of my program I want to ask the user if he wants to exit or not.
PROBLEM: I want to create a loop, that would send the user to beginning (Point A) if he enters n
or N
, or
to the end of my program (Point C) if he enters y
or Y
, or to the middle of the program (Point B) if he enters anything else.
How do I achieve this?
#include <stdio.h>
int main()
{
char exit=n;
A POINT
// imagine here some stuff
// some more stuff
// just a bit more junk
// some other C statements
B POINT
printf("wana exit? press y/n);
scanf("%c", &exit);
C POINT
return 0;
}