title: Error: request for member 'Name' in something not a structure or union
body: <p>I am trying to write a program that will read data from a text file(<strong>data2.txt</strong>) into a dynamic array. and then print that data out onto the screen. When I run my program I am getting the error shown below:</p>
  
  <pre><code>Error: request for member 'Name' in something not a structure or union.
  </code></pre>
  
  <p>I don't understand why I am getting this error since I have included a header file in my program that includes a structure. The size of the array P is the first integer number in the file. Any help\guidance will be greatly appreciated.</p>
  
  <p>Here is the content of the text file <strong>data2.txt</strong>:</p>
  
  <hr>
  
  <pre><code>5
  Martin Smith     22 2.2
  Austin Clinton   18 3.1
  Johnson          19 2.9
  Maggie Jones     23 2.3
  Tyler W Brown    16 3.4 
  </code></pre>
  
  <hr>
  
  <p>here is the content of the header file: </p>
  
  <hr>
  
  <pre><code>typedef struct RECORD
  {
  char Name[15];
  int Age;
  float Gpa;
  
  };
  </code></pre>
  
  <hr>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include "Mo.h"
  
  int main()
  {
  
  int n;
  int number = 0;
  int i=0;
  
  
  FILE * fpointer;
      fpointer = fopen("data2.txt", "r");
  
      fscanf(fpointer,"%d",&amp;number);
      n = number;
  
      printf("Size value is: %d \n", n);
  
     int *P = malloc(n*sizeof(int));
  </code></pre>
  
  <p><strong>[ERROR Showing on next line]</strong></p>
  
  <pre><code>  fscanf(fpointer,"%s %d %f", P[i].Name , &amp;P[i].Age, &amp;P[i].Gpa);
  
     while(! feof(fpointer))
     {
      printf("%s %d %.1f\n",P[i].Name , P[i].Age, P[i].Gpa);
       fscanf(fpointer, "%s %d %f",P[i].Name , &amp;P[i].Age, &amp;P[i].Gpa);
  
       i++;
     }
  
  
  
  free(P);
  
  
  fclose(fpointer);
  
  printf("\n\n");
  system("PAUSE");
  return 0;
  }
  </code></pre>