im trying to store an integer with a string. The string has an associated integer used to reference the string. the integers and strings are read in from a file and are in random order. then they have to be printed to an output file in sorted order. this is easy to do with the array of integers but the strings stay in the order they came in. i am using an array of structs but i cannot get the strings to stay with their corresponding integer.
first i tried storing the string in the actual number location of its integer but the integers go up to several thousands and i dont really want to malloc to 50,000 to try and cover all of the possibilities.
im trying to avoid linked lists but if you think that is a better solution let me know. thanks in advance for the help.