/*
QUESTION:
Can main function be called recursively on your system? Write a program that contains only the recursive case , and show the counter each time the main function is called recursively
*/
//CODE:
#include <iostream>
#include <conio.h>
using namespace std;
//MAIN STARTS
int main(int a){
static int b=0;
cout<<"FUNCTION IS CALLED"<<b<<"th time\n";
b++;
main(b);
return 0;
}
//MAIN ENDS
QUESTION:
Can main function be called recursively on your system? Write a program that contains only the recursive case , and show the counter each time the main function is called recursively
*/
//CODE:
#include <iostream>
#include <conio.h>
using namespace std;
//MAIN STARTS
int main(int a){
static int b=0;
cout<<"FUNCTION IS CALLED"<<b<<"th time\n";
b++;
main(b);
return 0;
}
//MAIN ENDS
No comments:
Post a Comment