title: How to write changes to the structure Singly linked list?
body: <p>I need to create a program in which a simply Singly linked list of students will be created. And I need to make it possible to change the name of a given student.
  As a result, changes to the structure are not recorded. I don't get an output about a successful recording.
  What's my mistake and how to fix?
  main.c code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;windows.h&gt;
  #define MAX 10
  #define KOL 15
  
  struct Student
  {
      int id;
      char Name[KOL];
      int Age;
      float AverageRaiting;
      struct Student* nextStudent;
  };
  
  void InitStudentList(struct Student** student)
  {
      *student = (struct Student*)
          malloc(sizeof(struct Student));
      (*student)-&gt;id = 1;
      printf("Enter 1 student name: ");
      scanf("%s", (*student)-&gt;Name);
      printf("Enter 1 student age: ");
      scanf("%d", &amp;(*student)-&gt;Age);
      printf("Enter 1 student average raiting: ");
      scanf("%f", &amp;(*student)-&gt;AverageRaiting);
      printf("\n");
      (*student)-&gt;nextStudent = NULL;
      struct Student* endStudent = *student;
      for (int i = 2; i &lt;= MAX; i++)
      {
          endStudent-&gt;nextStudent =
              (struct Student*) malloc(sizeof(struct Student));
          endStudent = endStudent-&gt;nextStudent;
          endStudent-&gt;id = i;
          printf("Enter %d student name: ", i);
          scanf("%s", endStudent-&gt;Name);
          printf("Enter %d student age: ", i);
          scanf("%d", &amp;endStudent-&gt;Age);
          printf("Enter %d average raiting: ", i);
          scanf("%f", &amp;endStudent-&gt;AverageRaiting);
          printf("\n");
          endStudent-&gt;nextStudent = NULL;
      }
  }
  
  void PrintList(struct Student* student)
  {
      struct Student* printStudent = student;
      printf("==========================\n");
      printf("Номер         Ім’я         Вік  Рейтинг \n");
      printf("==========================\n");
      while (printStudent)
      {
          printf("%d", printStudent-&gt;id);
          printf("%-15s", printStudent-&gt;Name);
          printf("%4d", printStudent-&gt;Age);
          printf("%8.2f", printStudent-&gt;AverageRaiting);
          printf("\n");
          printStudent = printStudent-&gt;nextStudent;
      }
      printf("==========================\n");
  }
  
  void FreeList(struct Student** student)
  {
      if (*student == NULL)
          return;
      struct Student* tmp = *student;
      struct Student* curr_stud;
      while (tmp)
      {
          curr_stud = tmp;
          tmp = tmp-&gt;nextStudent;
          free(curr_stud);
      }
      *student = NULL;
  }
  
  void ChangeStudentName(int n, char name[KOL], struct Student* students)
  {
      struct Student* st = 0;
      for (st = students; st &lt; students + MAX; st++)
      {
          if (st-&gt;id == n)
          {
              const int size=sizeof(st-&gt;Name);
              if(size &amp;&amp; size&gt;=sizeof(name))
              {
                  memcpy(st-&gt;Name,name,size);
                  st-&gt;Name[size-1]='\0';
              }
              printf("Changes are recorded");
              break;
          }
      }
  }
  
  int main(void)
  {
      int command;
      struct Student* BaseStudent = NULL;
      SetConsoleCP(1251);
      SetConsoleOutputCP(1251);
      InitStudentList(&amp;BaseStudent);
      for (;;)
      {
          printf("Enter command:\n 1 - Show students list,\n 2 - Change student name,\n 3 - Exit\n");
          scanf("%d", &amp;command);
          switch (command)
          {
          case 1:
              PrintList(BaseStudent);
              break;
          case 2:
          {
              int n;
              char name[KOL];
              printf("Enter student number: ");
              scanf("%d", &amp;n);
              printf("Enter new student name: ");
              scanf("%s", &amp;name);
              ChangeStudentName(n, name, BaseStudent);
              break;
          }
          case 3:
              FreeList(&amp;BaseStudent);
              return 0;
              break;
          default:
              printf("Error...");
              FreeList(&amp;BaseStudent);
              return 0;
              break;
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>I also tried recording like this:</p>
  
  <pre><code>strcpy(st-&gt;Name, name);
  </code></pre>
  
  <p>But it doesn't work too...</p>