-
element selection
Does anybody know if I can create a list of elements and randomally select an element from that list.
I need the program display more than one data type, and I know I could use several arrays, one for each type.but I want to know if there is another way of doing it, I also know that i could use multiple case or if statements.
But I think I remember seeing in someones source code a list of items seperated of braces without any keywords in between.
Just in case I'm not clear this is what I'm looking for, something like it anyway. Maybe it doesn't exist.
Code:
{
black;
green;
654;
}
{
red;
blue;
8784;
}
Thanks boys
-
You could use a structure and then just make an array of that struct.
Code:
typedef struct Test{
int Num;
char Letter;
char String[32];
} TEST;
//Later on
TEST Example[10] //Creates an array of Test structs
- Sean
-
Your right. I actually forgot about structures, but its not what I'm looking for.