Intanto mi sembra che questa

for (i=0;i<C;i++) (*B)[i]=(studente *)malloc(A*sizeof(struct studente*));

debba essere

for (i=0;i<C;i++) (*B)[i]=(studente *)malloc(A*sizeof(struct studente));