   Tree generator
  Hi, I try to make a tree generator like nvidia''s one. But I have an error I can''t understand. The prgoram compile but windows XP make a fatal error. If you''ve the time and some idea... ThanksIn fact, I know wich part of the program make the error:I try to do a recursive function wich display the tree in the same time it browse the binary tree. Here is the code wich make an error:Arbres.cpp :#include "Arbres.h"void Arbre::DrawArbre(){    DrawArbre2(Tree->Racine);    return;};void Arbre::DrawArbre2(Sommet *Racine){    if ((Racine->FilsGauche = NULL) && (Racine->FilsDroit = NULL))//si deux feuilles    {    DrawFeuilleGauche(Racine);    DrawFeuilleDroite(Racine);    }    else    { if (Racine->FilsGauche = NULL)//si feuille a gauche {DrawFeuilleGauche(Racine);DrawBrancheDroite(Racine);  DrawArbre2(Racine->FilsDroit);  }  else  {    if (Racine->FilsDroit = NULL)// si feuille a droite    {  DrawBrancheGauche(Racine);  DrawFeuilleDroite(Racine);  DrawArbre2(Racine->FilsGauche);   }   else    //si deux branches   {   DrawBrancheGauche(Racine);   DrawBrancheDroite(Racine);   DrawArbre2(Racine->FilsGauche);   DrawArbre2(Racine->FilsDroit);   } }}return;};void Arbre::DrawBrancheGauche(Sommet *Racine) // Faire un for qui dessine tous les morceaux du tronc{/*    for    {   for   {*/  float Diametre = 1, Size = 5;  glTranslatef(-Diametre, 0.0f, 0.0f);  glBegin(GL_TRIANGLES); glNormal3f( 0.0f, 0.0f, 1.0f); glVertex3f( 0.0f, 0.0f, 0.0f); glVertex3f(-0.5f * Size, Size, 0.0f); glVertex3f( 0.5f * Size, Size, 0.0f);  glEnd();  glTranslatef(Diametre, 0.0f, 0.0f);  glRotatef(Spread, 1.0f, 0.0f, 0.0f);  glRotatef(Twist, 0.0f, 1.0f, 0.0f);/*   }    }*/ return;};void Arbre::DrawBrancheDroite(Sommet *Racine){/*    for  for pour dessiner tout le tronc    {   for   {*/  float Diametre = 1, Size = 5;  glTranslatef(-Diametre, 0.0f, 0.0f);  glBegin(GL_TRIANGLES); glNormal3f( 0.0f, 0.0f, 1.0f); glVertex3f( 0.0f, 0.0f, 0.0f); glVertex3f(-0.5f * Size, Size, 0.0f); glVertex3f( 0.5f * Size, Size, 0.0f);  glEnd();  glTranslatef(Diametre, 0.0f, 0.0f);  glRotatef(Spread, 1.0f, 0.0f, 0.0f);  glRotatef(Twist, 0.0f, 1.0f, 0.0f);/*   }    }*/ return;};void Arbre::DrawFeuilleGauche(Sommet *Racine){    glRotatef(Twist, 0.0f, 1.0f, 0.0f);    glRotatef(Spread, 0.0f, 0.0f, 1.0f);    float Size = LeafSize / (Tree->NbFeuilles() * Racine->Generation);    glBegin(GL_QUADS);   glNormal3f( 0.0f, 0.0f, 1.0f);   glVertex3f( -0.5f * Size, 0.0f, 0.0f);   glVertex3f( 0.5f * Size, 0.0f, 0.0f);   glVertex3f( -0.5f * Size, Size, 0.0f);   glVertex3f( 0.5f * Size, Size, 0.0f);    glEnd();    return;};void Arbre::DrawFeuilleDroite(Sommet *Racine){    glRotatef(Twist, 0.0f, -1.0f, 0.0f);    glRotatef(Spread, 0.0f, 0.0f, 1.0f);    float Size = LeafSize / (Tree->NbFeuilles() * Racine->Generation);    glBegin(GL_QUADS);   glNormal3f( 0.0f, 0.0f, 1.0f);   glVertex3f( -0.5f * Size, 0.0f, 0.0f);   glVertex3f( 0.5f * Size, 0.0f, 0.0f);   glVertex3f( -0.5f * Size, Size, 0.0f);   glVertex3f( 0.5f * Size, Size, 0.0f);    glEnd();    return;};Arbres.h :#ifndef _ARBRES_H#define _ARBRES_H#include <gl\gl.h>#include "ArbreBinaire.h"class Arbre{    float Depth;   // N''intervient que ds la generation de l''arbre    float Balance; // De 0 à 1    float Twist;   // De 0 à 180    float Spread;  // De 0 à 90    float LeafSize;// N''importe    float BranchSize;   //    float Fullness;// ???    ArbreBinaire *Tree;    void DrawBrancheGauche(Sommet *Racine);    void DrawBrancheDroite(Sommet *Racine);    void DrawFeuilleGauche(Sommet *Racine);    void DrawFeuilleDroite(Sommet *Racine);    void DrawArbre2(Sommet *Racine);public:    Arbre()    {   //faire un arbre avec les paramètres de base et les initialiser   Depth = 2;   Balance = 0;   Twist = 0;   Spread = 45;   LeafSize = 2;   BranchSize = 1;   Fullness = 1;    };   void DrawArbre();    void ChangeSetting(char *Param, int val);};#endif 
  The first problem i see is that in every ''if'' your condition will always evaluate to true, because you use only one equal sign which means it''s the assignment operator.ex:  if ((Racine->FilsGauche = NULL) && (Racine->FilsDroit = NULL))//si deux feuillesThis will assign NULL to Racine->FilsGauche and to Racine->FilsDroitthe good syntax would be:if((Racine->FilsGauche == NULL) && (Racine->FilsDroit == NULL))but if i look at the code i think what you really want is to know if both are _not_ NULL, so it would be:if((Racine->FilsGauche != NULL) && (Racine->FilsDroit != NULL))Sorry if my post is confusing, english is not my primary language.hope that helps !Matt ;  Thank you !!!My language is not C and I just begin... 