so I was testing the recursive function , that is , will the function at first recursion , let the recursion complete and then proceed or will it simply initialize the recursion and proceed on , that is will both the recursive calls print numbers simultaneously or first it will print num
to 1 and then it will print num
to 100 ; anyway , my compiler is just outputing 32 infinitely when i give num
as 23 ;
void print(int num){
if(num == 1 || num == 100){
return;
}
std::cout << num ;
print(num-1);
std::cout << std::endl;
print(num+1);
return;
}
Aucun commentaire:
Enregistrer un commentaire