What I require is similar to array but for random numbers rather than (0,1,2,3…..).
I need to hold a number as the index/key and assign it a string.
For example student number, and then there name
So I could access students[number] and retrieve their name.
Similar to this code below but its in C++ and im using ANSI C
std::map <string, char> grade_list;
grade_list["John"] = 'B'
which was found here: http://www.cprogramming.com/tutorial/stl/stlmap.html
I just cant seem to find away to solve this problem in ANSI C.
Can any one reccommend any way to produce this?
EDIT: Another point is the values of the table will be hard coded and do not required to be change so it’s just a method with provides access to similar to…
name[accesskey] would return a string/data
GLIBS wont work because I’m using the compiler MINGW32 and there’s problems using it.
You can use GLib Hash table data structure.
http://developer.gnome.org/glib/2.30/glib-Hash-Tables.html