Facebook
From Bistre Gorilla, 2 Years ago, written in C.
Embed
Download Paste or View Raw
Hits: 242
  1. void AddStudent(int* numberOfStudents, char*** namesList, char*** surnamesList, int** yearsList, const char* firstName, const char* secondName, const char* surname, int year){
  2.        
  3.         *numberOfStudents = *numberOfStudents + 1;
  4.        
  5.         *namesList = (char**)realloc(*namesList, *numberOfStudents * sizeof(char*));
  6.         (*namesList)[*numberOfStudents-1] = (char*)firstName;
  7.         printf("%s\n", (*namesList)[*numberOfStudents-1]);// ------------------
  8.  
  9.         *surnamesList = (char**)realloc(*surnamesList, *numberOfStudents * sizeof(char*));
  10.         (*surnamesList)[*numberOfStudents-1] = (char*)surname;
  11.         printf("%s\n", (*surnamesList)[*numberOfStudents-1]);//----------------------
  12.        
  13.         printf("Pamiec, %i\n", *numberOfStudents * sizeof(int));//----------------------
  14.        
  15.         *yearsList = (int*)realloc(*yearsList, *numberOfStudents * sizeof(int));
  16.         (*yearsList)[*numberOfStudents-1] = year;
  17.         printf("%i\n", (*yearsList)[*numberOfStudents-1]);//----------------------
  18. }