Here is a simple code
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
void (*func[2])(int);
void main(int n=1)
{
int i;
cout<<endl<<n;
func[0]=&exit;
func[1]=&main;
i=++n<=10;
(func[i])(n);
}
Here I am satisfied with the output (i.e. 1 to 10 in different lines). The only thing which confused me was that why the global pointer is of the type void (*ptr[2])(int). If possible, please explain in simple words that why this pointer was taken so specifically
mainmust be defined to return anint, and take either no arguments or two arguments (anintand an array ofcharpointers).