Voici un ptit code (test.cpp) qui me laisse perplexe

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
void test(int& n)
{
   n++;
   if (n<1000000)
      test(n);
}
 
int main (int argc,char* argv[])
{
   int n = 0;
   test(n);
}

==> g++ test.cpp
==> a.out
==> segmentation fault

si je diminue la condition d'arret a 100000, ca marche.
Je ne comprend pas pourquoi ca plante avec 1000000.
Quelqu'un sait? Merci