title: Typedef struct and passing to functions
body: <p>I'm trying to declare a typedef struct array and then pass it to a function but i'm getting errors because i'm not exactly certain the proper syntax, help would be greatly appreciated. Here is my code:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  #define MAX_COURSES 50
  
  typedef struct courses      //creating struct for course info
  {
      int Course_Count;
      int Course_ID;
      char Course_Name[40];
  }course;    
  
  void Add_Course(course , int *);
  
  int main()
  {
      course cors[MAX_COURSES];
      int cors_count = 0;
  
      Add_Course(cors, &amp;cors_count);
      return 0;
  }
  
  void Add_Course(course cors, int *cors_count)
  {
      printf("Enter a Course ID: ");  //prompting for info
      scanf("%d%*c", cors.Course_ID);
      printf("Enter the name of the Course: ");
      scanf("%s%*c", cors.Course_Name);
  
      cors_count++;   //adding to count
  
      printf("%p\n", cors_count);
      return;
  }
  </code></pre>
  
  <p>The errors i'm getting are:</p>
  
  <blockquote>
    <p>error: incompatible type for argument 1 of ‘Add_Course’</p>
    
    <p>test2.c:28:6: note: expected ‘course’ but argument is of type ‘struct
    course *’</p>
    
    <p>test2.c: In function ‘Add_Course’:</p>
    
    <p>test2.c:81:2: warning: format ‘%d’ expects argument of type ‘int *’,
    but argument 2 has type ‘int’ [-Wformat]</p>
  </blockquote>
  
  <p>Any help would be appreciated</p>