Mapping string values
Make a struct containing the name and id.

struct device{char[MAX_ID_LENGTH] id; char[MAX_NAME_LENGTH] name; }


Then store the those pairs in an array which you can have sorted by one field or the other. That way you can binary search on that field.