Quote (KrzaQ2 @ Feb 27 2013 07:11pm)
What you're looking for is an associative array and there are no default implementations of those in C. In C++, you have std::map and std::unordered_map, in C you have to write one on your own.
this.
a fairly easy way to do this is by using structs imo
Code
struct something{
int num;
char name[56];
};
int main()
{
struct someting mystruct[10];
for(int i = 0; i < 10; i++)
{
mystruct[i].num = rand()%100+1;
mystruct[i].name = rand()%26+'a';
}
return 0;
}
another way to do this would to have two arrays
one an array of integers and another array of characters then line up the elements so that element n in the intereger array relates to element n in the character array.