title: Reading data from csv file into struct, getting errors back
body: <p>I'm trying to read data from a csv file into a struct. The struct contains int, char and   float members. I'm getting errors back except for the char member. I'm fairly new to C so   I appreciate your help!</p>
  
  <p>Data from csv file "Order":</p>
  
  <pre><code>0, cafe, 3.90, 0
  0, espresso, 3.50, 0
  ...
  </code></pre>
  
  <p>My struct:</p>
  
  <pre><code>typedef struct {                       
   int   position;
   char  name[20];
   float price;
   int   counter;
  }drink;
  
  void init(drink *pt)
  {
   FILE *fp;
   char buf[50];
   int i = 0, j;
   fp=fopen("Order", "r");
   while( fgets(buf,sizeof(buf),fp) != NULL)
   {
      strcpy(pt[i].position, strtok(buf,","));
      strcpy(pt[i].name, strtok(NULL,","));
      strcpy(pt[i].price, strtok(NULL,","));
      strcpy(pt[i].counter, strtok(NULL,","));
      ++i;
   }
  }
  
  int main()
  {
    int number = NR;
    int d=0;
    drink bar[number];          
    drink *pt = &amp;bar[0];
  
    welcome();
    init(pt);
    ...
    return 0;
   }
  </code></pre>