Warning! For teaching you this I may be tarred and feathered by many members of the forums. You too may be punished if spotted for using them. You have been warned
Ok now that we are done with the legal mumbo jumbo:
Example:
Code:
#include <iostream>
using namespace std;
int main(void) // btw, here is a correct usage of void. void can also mean no return type
//I want to define a place that can be refered to here.
{
lbl_i_want_to_go_back_to_the_beginning:
cout<<"Hello.\n";
cin.get();
cout<<"Press return to restart the program.\n";
cin.get();
//I want it to refer to the point above when it reaches this point.
goto lbl_i_want_to_go_back_to_the_beginning;
}
As for void (bolded), it means one or both of the following:
Example:
Code:
void function(int parameter); // function that has no return.
int function(void); // function that has no parameters.
// and again, you could have:
void function(void); // function that has no parameters and no return.
In C++ int main() and int main(void) would have the same meaning, but in C they do not. Also these are not to be confused with void pointers (void *) which are merely a placeholder for any type of pointer.