title: 2 questions on typedef struct and averages on grades. Am I doing it correctly In C?
body: <p>I need help on two questions, Its not homework but its to study for an exam. I need to have these questions because i was allowed 1 full page of notes for the exam. If you could help me these two simple questions for me that would be great. Here are the questions:</p>
  
  <ol>
  <li><p>"Write a function called getGrades. The function that repeatedly prompts the user for positive integers until the user enters a negative value to stop. The function should return the average of these grades and the  highest grade."</p></li>
  <li><p>"Write a function called Get_Info that takes a pointer to a student structure, (that has three fields: char array called name, an int id, and a double gpa) as its only argument. The function prompts the user for the required information to fill the structure and stores it in the appropriate fields." </p></li>
  </ol>
  
  <p>What I have so far, Let me know if they are correct and if i need to add anything.</p>
  
  <p>1.</p>
  
  <pre><code>double getGrades() {
    double average;
    double i;
    For(i=1 ; i&lt;i; i++)
    {
    printf("Enter Grade1:\n");
    scanf("%lf", &amp;i);
    }
    if (i&lt;0)
    {
  
    (double) average == (grade1 + grade2 + grade3) / 3;
    return average;
  }
   }
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>typedef struct {
    int id;
    double gpa;
    char name[SIZE];
  } student; 
  
  void Get_Info(student list[], int num) {
    int i;
    for(i=0; i&lt;num; i++) {
      printf("\nName:%s", list[i].name);
      printf("\nGPA:%lf", list[i].gpa);
      printf("\nID: %d\n", list[i].id);
    }
  }
  </code></pre>