I am to create an array of records, for students including the basic info-ID, First&Lastname, DOB,address,tel e number,program doing. Whats the correct approach to doing this?
How to create an array of records
Collapse
X
-
Is this to be an array on the stack or the heap?
On the stack (a local variable):
Or the heap:Code:struct MyStruct { /* etc...*/ }; MyStruct array[10]; //an array of 10
Code:MyStruct* array = malloc(10 * sizeof(MyStruct));
-
Presumably you would use a struct for your data variables. Then create an array of this struct.
You will need to format your output file in such a way so that you can read the data back. You can never read data back unless you already know how it was written.Comment
-
Comment