title: Not understanding a compiler warning when using strcmp and strcpy
body: <p>I'm relatively new to C language programming. I'm trying to program a School Record Management System for a school project. I understand your policy with regards to the "I'm not going to do your homework for you" so I will not ask how to do everything though I will provide the entire code I'm working on. The problem I'm facing at the moment is that I'm using strcpy and strcmp to prevent the user from assigning an already existing ID to a new student, but the compiler shows a warning/problem that I don't quite understand.</p>
  
  <p>Here is the <strong>compiler log</strong>:</p>
  
  <pre><code>Compiler: TDM-GCC 4.7.1 64-bit Release
  Executing gcc.exe...
  gcc.exe "C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_StudentManagement System.c" 
  -o "C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management System.exe"   
  -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include"
  -L"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib"
  -static-libgcc C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_StudentManagement System.c:
  In function 'add_student':
  C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management
  **System.c:222:4: warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast [enabled by default]**
  In file included from C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management System.c:8:0:
  
  **c:\program files (x86)\dev-cpp\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/include/string.h:51:18: note: expected 'char * __restrict__' but argument is of type 'char'**
  C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management
  **System.c:222:4: warning: passing argument 2 of 'strcpy' from incompatible pointer type [enabled by default]**
  In file included from C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management System.c:8:0:
  c:\program files (x86)\dev-cpp\mingw64\bin\../lib/gcc/x86_64-w64-**mingw32/4.7.1/../../../../x86_64-w64-mingw32/include/string.h:51:18: note: expected 'const char * __restrict__' but argument is of type 'char (*)[50]'**
  C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management 
  **System.c:227:5: warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast [enabled by default]**
  In file included from C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management System.c:8:0:
  **c:\program files (x86)\dev-cpp\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/include/string.h:53:15: note: expected 'const char *' but argument is of type 'char'
  C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management System.c:227:5: warning: passing argument 2 of 'strcmp' from incompatible pointer type [enabled by default]**
  In file included from C:\Users\Sheng\Desktop\Restarting Project\ToStudent\Updated_Student Management System.c:8:0:
  **c:\program files (x86)\dev-cpp\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/include/string.h:53:15: note: expected 'const char *' but argument is of type 'char (*)[50]'**
  
  Execution terminated
  Compilation successful
  </code></pre>
  
  <p><strong>Code</strong>:</p>
  
  <pre><code>struct Student
  {
  int num_student;            // number of students
  char student_name[50][50];      // name of students
  char student_id[50][50];        // Student ID
  int student_course_num[10];     // Number of course each student enroll
  int student_course[20][20];     // The course code of the student 
  };
  
  void add_student()
  {
  FILE *filePointer;
  int i;
  int user_input;
  int j;
  int replay = FALSE;
  char testID[50];
  struct Student profile[20];
  
  printf("---------------------------------------------------\n");
  printf("Option 3: Adding a Student\n");
  printf("---------------------------------------------------\n");
  printf("\n");
  
  filePointer = fopen("Student.txt","a+");
  if(filePointer == NULL)
  {
  printf("\nSystem Error...");
  printf("\nPress any key to exit");
  getch();
  }
  else
  {
      printf("Enter the number of students to be added: ");
      scanf("%d",&amp;user_input);
      for(i=0;i&lt;user_input;i++)
      {
          if(TRUE &amp;&amp; replay == FALSE)
          {
          printf("Enter Student Name: ");
          clearBuffer();
          scanf("%[^\n]",profile[i].student_name);
          }
  
          if(TRUE || replay == TRUE)
          {
          printf("Enter Student ID (8 digits): ");
          clearBuffer();
          scanf("%[^\n]",profile[i].student_id);
          }
  
          strcpy(testID[i],profile[i].student_id);
  
              for(j=0;j&lt;i;j++)
              {
  
              if(strcmp(testID[j],profile[i].student_id) == 0)
                  {
                      printf("The ID already exists");
                      i--;
                      replay = TRUE;  
                  }
              }
  
          if(replay == FALSE)
          {
          fprintf(filePointer,"%s\n%s\n",profile[i].student_name,profile[i].student_id);
          }   
      }
  }
  fclose(filePointer);
  return_menu();
  </code></pre>
  
  <p>}</p>