I made a console application and defined a function given below to exit the program. It confirms if the user really wants to exit by making him enter either yes or no. If he enters yes the program will quit nicely but if he enters no I want the program to return control to the start of the main function.
How can i do that ?
You can't do that in a single function that doesn't care about program structure.
Clearly something will need to call that function, so there is some structure in place. So you need to do the control there. Do not attempt to jump between functions in that way.
Perhaps if you could describe how your code works, someone could suggest a clean way to accomplish this.