title: read a text file into a binary tree but get run time error
body: <p>I'm having run time error in addStu function when trying to read data from input file to binary tree, is there anything wrong with the format or pointer usage?</p>
  
  <p>This is my code for reading file:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  
  #include "BST_ADT.h"
  
  // Structure
  typedef struct
      {
          char* name;
          char* market;
          char*  initial;
          float stock;
      }STUDENT;
  
  // Prototype Delarations
  void addStu    (BST_TREE* list);
  //void deleteStu (BST_TREE* list);
  //void findStu   (BST_TREE* list);
  //void printList (BST_TREE* list);
  //int  compareStu (void* stu1, void* stu2);
  //void processStu (void* dataPtr);
  
  
  int main (void)
  {
  // Local Definitions
     BST_TREE* list;
  // Statements
     list = BST_Create(compareStu);
     addStu(list);
     deleteStu(list);
     findStu (list);
     printList(list);
      return 0;
  }
  
  
  /*===================== addStu =========================*/
  
  void addStu    (BST_TREE* list)
  {
  // Local Declarations
     STUDENT* stuPtr;
     FILE* fp;
     char fileName[25];
     char buffer [100];
  // Statements
  
     stuPtr = (STUDENT*)malloc (sizeof (STUDENT));
  
     printf("Enter the file name: ");
             gets(fileName);
             fp = fopen(fileName, "r");
             if(fp == NULL)
             {
                  printf("Error cannot open the file!\n");
                  exit(101);
             }
     while(fgets(buffer, 100, fp) != NULL)
          {
              if (!stuPtr)
                  printf("MEmory overflow!\n"), exit(101);
              sscanf(buffer, "%s %s %s %f", stuPtr-&gt;name, stuPtr-&gt;market, stuPtr-&gt;initial, &amp;(stuPtr-&gt;stock));;
          } // end while
  
     BST_Insert(list, stuPtr);
  } //addStu
  </code></pre>
  
  <p>this is my input:</p>
  
  <pre><code>Microsoft Corporation;   NASDAQ MSFT    259.94B  
  Yahoo! Inc.;         NASDAQ YHOO    37.67B  
  Baidu.com, Inc. (ADR);   NASDAQ BIDU    8.64B  
  CNET Networks, Inc.;     NASDAQ CNET    1.13B  
  QuickLogic Corporation;  NASDAQ QUIK    88.62M  
  Answers Corporation;     NASDAQ ANSW    53.49M  
  Apple Inc.;              NASDAQ AAPL    114.17B  
  EarthLink, Inc.;         NASDAQ ELNK    890.68M 
  Amazon.com, Inc.;        NASDAQ AMZN    28.28B  
  IAC/InterActiveCorp;     NASDAQ IACI    6.09B    
  Time Warner Inc.;        NYSE   TWX 57.29B
  </code></pre>