Apparently you're confusing an array of alumn structs with an array of pointers to alumm struct.
The Bubble logic expexts the array of pointers, whereby the main function seems to call it with an array of structs.
Because of the size of the alumn struct, it is probably more efficient to perform the bubble sort on pointers, since each swap will require much less moving around of data (3 copies of one pointer a few bytes each, vs. 3 copies of alumn struct, 200+ bytes each!).
I suggest you modify the logic (not shown in snippet of question) of the main() function to introduce such an array of pointers to the actual alumn structs. (Of course this array of pointers won't spare you from also allocating the structs themselves, en block (in an array of structs) or individually.
Upon your insistence I'm hinting here how main could look like to produce an array of pointer usable by bubble (bubble stays unchanged).
BTW, I declare alumns as alumn *alumns[]
which shows the intent use more readily. this is the same thing as alumn **alumns
.
int main(int argc, char **argv)
{
alumn *alumns[]; // changed to array of pointers [to alumn structs]
// was pointer to alumn struct, likely to be used as an array thereof
int MaxNbOfAlumns = some_limit;
alumns = malloc(sizeof(*alumn) * MaxNbOfAlumns);
// Load the alumn records (from file or whereever)
// pseudo code:
// int i_alumns = 0; // points to the next free slot in alumns array
// for each record (in file or whereever...)
// alumms[i_alums] = malloc(sizeof(struct alumn));
// strcpy(alumms[i_alums]->lastname, whatever_data);
// strcpy(alumms[i_alums]->name, whatever_otherdata);
// alumms[i_alums]->par = some_int_data;
// alumms[i_alums]->nota = some_other_int_data;
// i_alums++;
... here goes some other code ...
bubble(alumns, totalAlumns); // alumns now being an array can be passed as is.
return 0;
}
Alternatively if you wish to keep the original alumns variable as previously, all that may be needed is something like that, just before the call to bubble()
int i;
alumn *ap_alumns[]; // new variable
ap_alumns = malloc(sizeof(*alumn) * totalAlumns);
for (i = 0; i < totalAlumns; i++)
ap_alums[i] = &alumns[i];
bubble(ap_alumns, totalAlumns);
One thing that should be stressed is that regardless of its genesis, the array passed to bubble() gets sorted ok, but to use it you need to dereference the individual pointers.
Whereby with the old array you intended to use as in say alumns[123].lastname
, you'll now need alumns[123]->lastname
(or ap_alumns[123]->lastname
if you use the second version).