I'm super new to C and trying to write my first real program.
I'm not connecting to an actual DB, I just need a table to hold records during runtime. The user will be adding and deleting records from the table, so I need to be able to change the number of elements in the array (i.e. adding and deleting records).
I am currently using an array of structs but I don't know how to redefine the array larger (for adding records) or smaller (for deleting records). And in all reality, I don't even know if an array of structs is the right tool for this job.
Here is how I'm creating the array of structs:
Then I am able to access this bad boy with something like:
// define the structure
// declare an array of the structure
struct CueRecord CueSheet;
Is there a way to redefine the array from 10 elements to 9... or from 10 to 11 (etc)? Or should I be looking at a different tool for this job?
// add a record to the cue sheet table
int AddCueToCueSheet(int ArrayIndex, int PrimaryKey, float CueNumber, char CueName)
// this is for testing purposes
printf("\nAdding record with array index %d\n", ArrayIndex);
// insert a record into table
CueSheet[ArrayIndex].PrimaryKey = PrimaryKey;
I'm not looking for it to be spelled out for me... just looking to be pointed in the right direction. Thanks in advance!