Malloc the struct
Well I have the struct here, an array of structs actually. I have to malloc it, and then free. How is it done, in codes? Thanks for any help. I'm driven crazy for days but I can't do it.
char id, grade;
struct Student Stud;
Put the struct prototype, before main() (global space), and include the header file, stdlib.h.
Do you want to malloc the int's for tests?
should do it.
Stud[i].test = malloc(Number of Test int's you want * sizeof(int));
You may want to study this link for DYNAMIC MEMORY ALLOCATION .
Thanks a lot! The link helped a lot.
Originally Posted by jimblumberg
Yes, I wanted to malloc them. Thanks for the code!
Originally Posted by Adak