-
structs
Ok I am getting confused- laugh if you must! When you create a struct and you are reading in the information to the struct, say you need to read in 10 things, can you hold all within the one struct or do you need to pass it along to a "holding place"??
-
A structure is just a chunk of memory of certain size. You can't just 'automagically' store 10 structures in 1, no. Try using an array of structs, a linked list of them, etc.
-
ok I will try that thanks!!
-
>>say you need to read in 10 things, can you hold all within the one struct
Yes, if you want to. This will give you one struct that holds 10 names:
Code:
struct foo
{
char Names[10][MAX_LEN_NAME];
};
struct foo bar;
However, depending on how you're using the data, and how it's all related, you may need the array of structs as already mentioned.
Code:
struct foo
{
char Name[MAX_LEN_NAME];
};
struct foo bar[10];