How to run code again without return 0? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to run code again without return 0?

What do I do if I want a code to start from the beginning again without return 0 (without a loop)? Is it just a simple command?

12th Sep 2016, 2:00 PM
Squik
Squik - avatar
1 Answer
+ 1
Just make a recursive function with the code you want to return to the beginning to. Main cannot be recursive hence the creation of a different function. Example: void sayhi() { cout << "hi"; sayhi() } int main() { sayhi(); }
12th Sep 2016, 11:56 PM
Cohen Creber
Cohen Creber - avatar