If you follow the pattern
Code:
thing = malloc ( N * sizeof *thing );
you need not worry about getting it correct.
So this
Code:
group_total = malloc (x * sizeof (long **));
becomes this
Code:
group_total = malloc (x * sizeof *group_total);
This
Code:
group_total[loop] = malloc (y * sizeof (long *));p
becomes this
Code:
group_total[loop] = malloc (y * sizeof *group_total[loop]);
And this
Code:
group_total[loop][loop2] = malloc (z * sizeof (long));
becomes
Code:
group_total[loop][loop2] = malloc (z * sizeof *group_total[loop][loop2]);
Then you can change **group_total to say double and have nothing to change but the declaration of group_total.